How to fix the datetime2 out-of-range conversion error using DbContext and SetInitializer?

前端 未结 15 873
-上瘾入骨i
-上瘾入骨i 2020-12-07 19:39

I\'m using the DbContext and Code First APIs introduced with Entity Framework 4.1.

The data model uses basic data types such as string

15条回答
  •  失恋的感觉
    2020-12-07 20:18

    In case anyone is as dopey as me, double check the year of your date. I was converting a date from a text file in YYMMDD format so was creating a date with a year of 0020, not 2020. Obvious error but I spent more time looking at it but not seeing it than I should have!

提交回复
热议问题