3
I have a question about these two ways to specify whether an entity has been modified. I usually use DbEntityEntry.State
with the EntityState.Modified
when I make a very big change in model and I want them all to be persisted in the database, and I use the DbPropertyEntry.IsModified
with true
when I want to specify that only one property has been modified.
So supposing I have one model and that I update several properties of it (but not all) during a process. I then mark the model (and not the modified properties) as EntityState.Modified
through property DbEntityEntry.State
.
When I apply the changes through the DbContext.SaveChangesAsync()
all model properties will be updated in the database or only those that have actually been modified? A SQL UPDATE command will be generated that will include all fields in the model in updating?
Vlw, you cleared my doubt.
– Zignd