title: Inserting current Database date time via Entity framework
body: <p>We want to put the current datetime into a database column.</p>
  
  <p>We have a web farm where the time on the web servers can vary, we therefore need to use the datetime on the database server.</p>
  
  <p>We have a database with a <code>Not Null</code> datetime column. This column has a default datetime of current time.</p>
  
  <p>This works fine when we insert data using a SQL statement that does not include the datetime column.</p>
  
  <p>From Entity Framework:</p>
  
  <ul>
  <li>If we define the datetime as <code>not null</code>, the datetime is set to low date, and low date is inserted into the database.</li>
  <li>If we define the datetime as <code>null</code>, we get an exception on the insert that the value cannot be null.</li>
  </ul>
  
  <p>We could fix this using a database trigger that changed the datetime to current datetime if the insert value is low date. </p>
  
  <p>Does anyone have a better solution?</p>