title: Entity Framework Mapping DateTimeOffset to SQL Server DateTime
body: <p>Is there a way to map a <code>DateTimeOffset</code> property to a SQL Server <code>datetime</code> column, with the assumption that you can't change either side, meaning that the property and column have to stay those date types?</p>
  <p>I know the easiest is to make them match but want to know if there's a way to work around this. I was looking into custom mappings but it seemed like I had to map all of the columns myself and not just the <code>DateTimeOffset</code> property.</p>
  <p>I tried:</p>
  <pre><code>modelBuilder.Entity&lt;Customer&gt;().Property(c =&gt; c.LastModifiedOn).HasColumnType(&quot;datetime&quot;);
  </code></pre>
  <p>But that threw the <code>Member Mapping specified is not valid</code> error.</p>
  <p>I was hoping to be able to put the <code>UtcDateTime DateTimeOffset</code> property value in the DB and when reading have the <code>DateTimeOffset</code> be in UTC (i.e. have an Offset of zero).</p>