This is a migrated thread and some comments may be shown as answers.

Fluent Model doesn't suppport DateTimeOffset

1 Answer 60 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 07 Oct 2016, 08:34 PM
I was attempting to switch from a working rlinq (Domain XML mapping) to a Fluent Model Mapping when I discovered that my fields that were DateTimeOffset could only be mapped to a plain DateTime. It worked fine with rlinq; is this a permanent limitation of the Fluent Model when compared to the Domain Model (XML Mapping)? The issue appears to be OpenAccessType enum doesn't have a DateTimeOffset option, only Date, Time, and DateTime. My current version is Telerik.OpenAccess 2016.2.822.1

1 Answer, 1 is accepted

Sort by
0
Luke
Top achievements
Rank 2
answered on 06 Jan 2017, 12:15 AM

Hi Michael,

Hopefully you managed to resolve this. For future people coming across this thread you may work around this issue by removing .HasDefaultValue()

And put the "default value" on your objects constructor or as a default value on the property.

configuration.HasProperty(x => x.ModifiedDate).HasFieldName("_modifiedDate").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("ModifiedDate").IsNotNullable().HasColumnType("datetimeoffset").HasDefaultValue();
 
configuration.HasProperty(x => x.ModifiedDate).HasFieldName("_modifiedDate").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("ModifiedDate").IsNotNullable().HasColumnType("datetimeoffset");
Tags
Data Access Free Edition
Asked by
Michael
Top achievements
Rank 1
Answers by
Luke
Top achievements
Rank 2
Share this question
or