title: DateTime error when updating rows using EF
body: <p>I have a method that gets an existing row from a table in my database and updates some values on it and then save those changes.  The table in quesiton has these columns:</p>
  
  <p><img src="https://i.stack.imgur.com/c0cW3.png" alt="columns in table"></p>
  
  <p>The code that does the updating is here:</p>
  
  <pre><code>        public void Update(Accommodation accommodation, string code, int supplierId)
          {
              var existingAccommodation = Get(a =&gt; a.Code == code &amp;&amp; a.SupplierId == supplierId);
  
              DateTime now = DateTime.Now;
  
              existingAccommodation.ModifiedDate = now;
              existingAccommodation.Description = accommodation.Description;
              existingAccommodation.Introduction = accommodation.Introduction;
              existingAccommodation.Name = accommodation.Name;
              existingAccommodation.Strapline = accommodation.Strapline;
              existingAccommodation.Type = accommodation.Type;
              existingAccommodation.Processed = true;
  
              DataContext.SaveChanges();
          }
  </code></pre>
  
  <p>The problem is that the line <code>DataContext.SaveChanges();</code> causes an exception whose innerexception says:</p>
  
  <pre><code>The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value
  </code></pre>
  
  <p>This is where the above code is called</p>
  
  <pre><code>            Accommodation existingAccommodation = GetByCode(code, supplierId);
              if (existingAccommodation != null)
              {
                  _accommodationRepository.Update(
                      accommodation, code, existingAccommodation.SupplierId);
              }
  </code></pre>