I am trying to update my entity using Entity Framework 4.1 code First approach like this(In my Repository Class):
internal void SaveAccount(Account account) {
context.Entry(account).State = EntityState.Modified;
context.SaveChanges();
}
but I am getting an error which is:
Cannot update identity column 'Unique ID'.
I am not updating Unique ID Column. How can I avoid this error ?
I added this attribute to my Model property and error gone:
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]