I use EF to update an object.
Here is my code:
public MamConfiguration_V1 Save(MamConfiguration_V1 item) { item.ThrowIfNull("item"); mMaMDBEntities.MamConfiguration_V1.AddObject(item); mMaMDBEntities.ObjectStateManager.ChangeObjectState(item, System.Data.EntityState.Modified); mMaMDBEntities.SaveChanges(); return item; }
However, this way I get por erorr violation in the database.
I prefer to use this method (creating a new EF object) and marking it as
changed, how can I not break the uniquness restriction?
source share