Fluent Model doesn't suppport DateTimeOffset

2 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Feb 2015

    Posted 07 Oct 2016 Link to this post

    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
  2. Luke
    Luke avatar
    4 posts
    Member since:
    Mar 2014

    Posted 05 Jan in reply to Michael Link to this post

    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");
Back to Top