My code The first models have System.DateTime properties. When the database seeding code is called, it throws this exception:
SqlException (0x80131904): Converting datetime2 data type to datetime data type has exceeded the value.
I am creating a new DateTime object with a constructor. Code First creates a database schema. How can I overcome this obvious error in Code First? I do not really care about my data type. I just need to keep the date and maybe the time of day, but not important.
I looked and read a lot of messages, but none of these errors indicated that they were derived from the data schema created by CodeFirst. The closest answer I found included making changes to the ProviderManifestToken in the edmx file, but my project does not have the edmx file. I did not use the constructor, I use Code First.
source share