Question

Is there a way? The following doesn't work:

var customer = constructor.Entity<Customer>();
customer.Property(c => c.Date).DataType("smalldatetime");
Was it helpful?

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
scroll top