I am looking at EntityFramework.Extended . It can run Update() and Delete() on the db entities. like:
//delete all users where FirstName matches
context.Users.Delete(u => u.FirstName == "firstname");
But the funny thing is, it don’t need to call context.SaveChanges(), it just go directly into the DB and delete the records.
Is it a bad design? I think every modification on entities will need to call SaveChanges() to take effect and keep the correct relationships and mappings between database and memory objects.
You have to understand what SaveChanges does. SaveChanges commits object model changes that are stored in the current Local cache.
The library you are referring to generates SQL command statements, and do not modify the object context. As such, since the object context is not altered, there are no changes to save (in other words, SaveChanges refers to the data model, not the database).
To illustrate this… Imagine the difference between your kids taking the bus to school, and you dropping them off.
When they take the bus to school, the school bus drives around to its various stops, and then when it’s finished the bus drops all the kids off at once. This is sort of like calling SaveChanges.
But when you take you drop your kids off at school, it’s a single task that gets done in a single action, at the time you do it.