jgauffin
jgauffin

Reputation: 101194

Entity framework date/time conversion for sqlserver

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

Is it possible 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)

Upvotes: 4

Views: 1545

Answers (1)

Dave Brace
Dave Brace

Reputation: 1809

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

Upvotes: 2

Related Questions