title: Entity Framework Cannot Save - Conversion Of Datetime2 To DateTime Failing
body: <p>I'm running into an issue where a few of my Entity Framework entities are failing to save data. The error I get is </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>I have a table called "Notes". It has a datetime field called "NoteDateTime". Here is a snippet of the SQL used to create the table. As you can see, the NoteDateTime field has nothing unusual about it.</p>
  
  <pre><code>CREATE TABLE [db].[Notes](
      [NoteID] [int] IDENTITY(1,1) NOT NULL,
      [NoteText] [varchar](8000) NULL,
      [NoteDateTime] [datetime] NULL,
      [IsReviewRequired] [bit] NULL,
      [ConvertToGlobal] [bit] NULL,
      [EmployeeID] [int] NULL,
      [EvaluationID] [int] NULL,
      [CustomerID] [int] NULL,
      [EmailID] [int] NULL,
      [AddedWhenMerged] [bit] NULL,
  CONSTRAINT [PK_Notes] PRIMARY KEY CLUSTERED 
  (
      [NoteID] ASC
  )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  ) ON [PRIMARY]
  GO
  </code></pre>
  
  <p>In my C# code, I populate a "Notes" entity and call the SaveChanges() method. The error occurs when I call SaveChanges().</p>
  
  <pre><code>dbContext.Notes.Add(new Note
  {
      EvaluationID = evaluationId,
      CustomerID   = customerId,
      EmployeeID   = employeeId,
      NoteDateTime = DateTime.Now,
      NoteText     = noteText,
  });
  
  dbContext.SaveChanges();
  </code></pre>
  
  <p>I've read several stackoverflow threads and the advice was to ensure the proper date was being used and that the date should not be null. The date is not null and it is certainly within acceptable min/max limits. I also tried converting the type of the column to datetime2 in the database, but that didn't fix the issue. The bizarre thing is that this seems to be a recent issue. The only thing I can think of that changed in our environment is that we migrated our project to use MVC 4.</p>
  
  <p>What can I do to troubleshoot this problem and get my Note entity to save properly?</p>