DbSet.Attach(entity) vs DbContext.Entry(entity).State = EntityState.Modified
147
When I am in a detached scenario and get a dto from the client which I map into an entity to save it I do this:
context.Entry(entity).State = EntityState.Modified;
context.SaveChanges();
What is the DbSet.Attach(entity)
used for then?
or why should I use the .Attach
method when EntityState.Modified
already attaches the entity?