title: Force DateTime with Entity Framework Database First
body: <p>I am connecting to a database using EF database first.  Therefore my models are autogenerated.</p>
  
  <p>When I update a record my DateTimes are getting written as SQL type DateTime2.  The production server is SQL Server 2005 (no comments please), so the updates fail as DateTime2 is not supported.</p>
  
  <p>I've tried creating a metadata class for my model as per <a href="http://www.asp.net/mvc/overview/getting-started/database-first-development/enhancing-data-validation" rel="nofollow">http://www.asp.net/mvc/overview/getting-started/database-first-development/enhancing-data-validation</a> and decorating the member with [Column(DbType = "datetime")], but either I'm not following the instructions properly or I'm on the wrong track.</p>
  
  <p>How can I get EF database first to use DateTime when writing to the database?</p>
  
  <p>Thanks</p>