title: Updating an MVC application Model along with data-source
body: <p>Firstly, new to Asp.Net MVC and ADO.NET entity data model.</p>
  
  <p>While practicing an example, I created a table but forgot to set <strong>"Identity specification</strong>" to true for <strong>PK</strong>.</p>
  
  <p>Created a model for MVC Application using entity data Model and worked fine.</p>
  
  <p>Later on I've have set that <strong>"Identity specification</strong>" to true for that table in the DB.</p>
  
  <p>When I try to insert a record an exception is raised and record does not get inserted.</p>
  
  <blockquote>
    <p>{"Cannot insert explicit value for
    identity column in table 'Contacts'
    when IDENTITY_INSERT is set to OFF."}</p>
  </blockquote>
  
  <p>Here is the digner created class in the model, which should have changed as per schema changes in DB</p>
  
  <pre><code>public static Contact CreateContact(int id, string firstName, string lastName, string phone, string email)
          {
              Contact contact = new Contact();
              contact.Id = id;
              //
              return contact;
          }
  </code></pre>
  
  <p>There is no need for "Id" variable in the above Method Signature as but it is still auto generating that.</p>
  
  <p><strong>How can we make our model to refresh itself or manually,
  if the database schema is updated.</strong></p>
  
  <p><strong>NOTE</strong>: using C#, ASP.NET MVC</p>
  
  <p>Thanks</p>