开发者

Entity framework date/time conversion for sqlserver

开发者 https://www.devze.com 2023-01-14 22:52 出处:网络
I prefer working with DateTime.MinValue, even if I use SqlServer as backend. Is it poss开发者_C百科ible to make Entity Framework to convert from DateTime.MinValue to 1753-01-01 when saving entities a

I prefer working with DateTime.MinValue, even if I use SqlServer as backend.

Is it poss开发者_C百科ible to make Entity Framework to convert from DateTime.MinValue to 1753-01-01 when saving entities and convert back to DateTime.MinValue when fetching them?

Edit: I do not want to use DateTime? (nullable value type)


If SQL Server 2008 is an option, you could go with using datetime2 in your database which would allow you to store DateTime.MinValue.

0

精彩评论

暂无评论...
验证码 换一张
取 消