title: entity framework avoid convert datetime to datetime2
body: <p>I have a column <code>create_date</code> store in <code>datetime</code>.</p>
  
  <p>When I query by this column, entity framework generate SQL like:</p>
  
  <p><code>([Extent1].[create_date] &gt;=  CAST( @p__linq__3 AS datetime2))
  AND ([Extent1].[create_date] &lt;=  CAST( @p__linq__4 AS datetime2))</code></p>
  
  <p>The <code>CAST</code> here is not necessary, and it takes lower performance.</p>
  
  <p>I have tried these:</p>
  
  <pre><code>[Column(TypeName = "datetime")]
  public Nullable&lt;System.DateTime&gt; create_date { get; set; }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      modelBuilder.Entity&lt;myClass&gt;().Property(o =&gt; o.create_date).HasColumnType("datetime");
  }
  </code></pre>
  
  <p>Both don't work.</p>
  
  <p>How to avoid <code>CAST</code>?
  I want entity framework generate SQL like:</p>
  
  <p><code>([Extent1].[create_date] &gt;=  CAST( @p__linq__3 AS datetime))
  AND ([Extent1].[create_date] &lt;=  CAST( @p__linq__4 AS datetime))</code></p>
  
  <p>I don't think change .edmx: <code>&lt;Schema .. ProviderManifestToken="2008"</code> is a good solution.</p>