A
arnaud.helin
Guest
Hi everyone,
I have two differents behavior when I use Entity attribute on my Code First project.
Here is the part of the code :
[Required]
[Column("Email")]
[EmailAddress]
[Display(Name = "Email")]
public string ProxyAddresses { get; set; }
[Column("BirthDate")]
[Display(Name = "Birthdate")]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}")]
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }
[Column("AccountExpires", TypeName = "DateTime2")]
[Display(Name = "Expiration Date")]
[AllowNull]
[MaybeNull]
public DateTime AccountExpires { get; set; }
The ProxyAddress field is correctly set to allow Null (or not if I add [Required] attribute). But for the others, it does not work. Even if I add [AllowNull] and [MaybeNull], the SSMS shows me that the fields are not allowed to be null.
Can you help me to find the reason of this behavior ?
Regards,
Arnaud H.
The key of learning is practice.
Continue reading...
I have two differents behavior when I use Entity attribute on my Code First project.
Here is the part of the code :
[Required]
[Column("Email")]
[EmailAddress]
[Display(Name = "Email")]
public string ProxyAddresses { get; set; }
[Column("BirthDate")]
[Display(Name = "Birthdate")]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}")]
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }
[Column("AccountExpires", TypeName = "DateTime2")]
[Display(Name = "Expiration Date")]
[AllowNull]
[MaybeNull]
public DateTime AccountExpires { get; set; }
The ProxyAddress field is correctly set to allow Null (or not if I add [Required] attribute). But for the others, it does not work. Even if I add [AllowNull] and [MaybeNull], the SSMS shows me that the fields are not allowed to be null.
Can you help me to find the reason of this behavior ?
Regards,
Arnaud H.
The key of learning is practice.
Continue reading...