I am using Entity Framework Code First method to create my database table. The following code
creates a DATETIME
column in the database, but I want to create a
I use following
[DataType(DataType.Time)]
public TimeSpan StartTime { get; set; }
[DataType(DataType.Time)]
public TimeSpan EndTime { get; set; }
[DataType(DataType.Date)]
[Column(TypeName = "Date")]
public DateTime StartDate { get; set; }
[DataType(DataType.Date)]
[Column(TypeName = "Date")]
public DateTime EndDate { get; set; }
With Entity Framework 6 & SQL Server Express 2012 - 11.0.2100.60 (X64). It works perfectly and generates time/date column types in sql server