Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datetime2 conversion error when saving #156

Open
walmanarias opened this issue Feb 6, 2018 · 1 comment
Open

Datetime2 conversion error when saving #156

walmanarias opened this issue Feb 6, 2018 · 1 comment

Comments

@walmanarias
Copy link

The conversion of a datetime2 data type to a datetime when trying to save the entitities

@andy952
Copy link

andy952 commented Feb 5, 2019

This is a common error people face with Entity Framework. This occurs when the entity associated with the table being saved has a mandatory datetime field and you do not set it with some value.

The default datetime field is created with a value of 01/01/0001 and will be used in place of null. This will be sent to the datetime column which can hold date values from 01/01/1753 00:00:00 and onwards, but not before, leading to the out-of-range exception.

This can be resolved by either modifying the database field to accept null or by initializing the field with a value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants