コードで範囲 (または他のモデルDataAnnotations
属性) を設定し、すべてのDataAnnotations
動作を維持することは可能ですか?
つまり、ValidationMessageFor
?
私の現在の「静的」モデル
[Required]
[DisplayName("Price")]
[RegularExpression(@"[0-9]+(\.[0-9][0-9]?)?$", ErrorMessage = "Invalid price format")]
public decimal MinimumPrice { get; set; }
ありがとう!