title: Handling Dates with OData v4, EF6 and Web API v2.2
body: <p>I'm in the midst of upgrading from v1-3 to v4, but I've run into a few problems.</p>
  
  <p>My understanding is that DateTime is unsupported, and I have to always use DateTimeOffset. Fine.</p>
  
  <p>But before I was storing Sql <code>date</code> data type in the DateTime, now it seems I get this error:</p>
  
  <pre><code>Member Mapping specified is not valid. The type 'Edm.DateTimeOffset[Nullable=False,DefaultValue=,Precision=]' of member 'CreatedDate' in type 'MyEntity' is not compatible with 'SqlServer.date[Nullable=False,DefaultValue=,Precision=0]'
  </code></pre>
  
  <p>What is the work around for this? I need to be able to store specifically just dates in the database (time and locality is not important). Would be great if I could get the Edm.Date aswell as a returned data type, but I didn't have that before.</p>
  
  <p>Thanks.</p>
  
  <p>Edit: Example classes</p>
  
  <p>Before:</p>
  
  <pre><code>public class Ticket
  {
      [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
  
      [Required, MaxLength(50)]
      public string Reference { get; set; }
  
      [Column(TypeName = "date")]
      public DateTime LoggedDate { get; set; }
  }
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>public class Ticket
  {
      [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
  
      [Required, MaxLength(50)]
      public string Reference { get; set; }
  
      [Column(TypeName = "date")]
      public DateTimeOffset LoggedDate { get; set; }
  }
  </code></pre>
  
  <p>This isn't valid in EF.</p>