Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EF & small date time
Message
General information
Forum:
ASP.NET
Category:
MVC
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01570980
Message ID:
01571016
Views:
33
>Are you using CodeFirst? In that case just declare the date as SmallDateTime. In the entity designer there's a dropdown to pick type and the SqlDbTypes should all be there I believe (it's been a long time since I used the designer though so not sure what that looks like today).
>
I am using CodeFirst and I am not using EF designers. I have all my classes defined in code.

Here is what I have
[DataType(DataType.DateTime)]
      [DisplayName("Created on")]
      [Column("enteredon", TypeName = "smalldatetime")]
      public DateTime EnteredOn { get; set; }

      [DataType(DataType.DateTime)]
      [DisplayName("Modified on")]
      [Column("modifiedon", TypeName = "smalldatetime")]
      public DateTime? ModifiedOn { get; set; }
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform