How to set data type property as smalldatetime
-
26-09-2019 - |
Question
Is there a way? The following doesn't work:
var customer = constructor.Entity<Customer>();
customer.Property(c => c.Date).DataType("smalldatetime");
Solution
customer.Property(c => c.Date).HasStoreType("smalldatetime");
OTHER TIPS
My code first approach:
[Table("Customer", Schema = "DBSchema")]
public class Customer{
[Column("Date", TypeName = "SmallDateTime")]
public DateTime Date{ get; set; }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow