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