Is there a way to automagically map a DateTime.MinValue
to a null value in the data layer and vice-versa?
I am trying out EF6. I want to eventually target SQL Server 2005 servers, so the DATETIME2
type is something I want to avoid.
Is there a way to automagically map a DateTime.MinValue
to a null value in the data layer and vice-versa?
I am trying out EF6. I want to eventually target SQL Server 2005 servers, so the DATETIME2
type is something I want to avoid.
EF 不支持通过 mapping/fluent API 将 min/max/specific 值映射为 null。您可以在保存时覆盖SaveChanges()
和检查/更新实体,但它会涉及更多
有两种方法可以解决它: