In EF6, is there a annotation that will allow empty string but not allow null?
I've tried [Required]. But this annotation does not allow empty string or null.
[Required]
[MaxLength(80)]
public string ShortDescription { get; set; }
Looks like I just need to add the (AllowEmptyStrings = true) option to the [Required] annotation.
[Required(AllowEmptyStrings = true)]
[MaxLength(80)]
public string ShortDescription { get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With