This question is locked. New answers and comments are not allowed.
Hi,
I'm in the process of creating OData services for a legacy SQL Server database which uses datetime fields. The issue is that OData doesn't support DateTime properties, and I can't figure out how to map a datetime field to a DateTimeOffset property using fluent mapping so that OData will work.
I've tried:
configuration.HasProperty(x => x.CreatedOn).WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("CreatedOn").HasColumnType("datetime").IsNotNullable();Unfortunately, the datetime to DateTimeOffset conversion throws an exception.
Is it possible to map a datetime database field to a DateTimeOffset property? I noticed a WithConverter<> extension. Would creating a custom AdoTypeConverter class do the trick?
Thanks,
-Cory