Why does EF5 code first use datetime2 when inserting a nullable datetime into the database?
问题 I am saving a Cart object to the database that has a nullable datetime. This is the error I get: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. There are quite a few stackoverflow posts documenting fixes to this problem. However, when code first is creating the database it will create the field as a DateTime (allow nulls). But for some reason, code first tries to insert using a DateTime2 field. I am wondering why EF creates the field one way