how to extend entity framework ,To achieve this effect
db.Users.Delete(o=>o.sex=="girl") db.Users.Update(o=>o.sex="girl")
Can batch mo开发者_StackOverflow社区dification and deletion, insert data
怎样扩展entity framework ,可以实现批量修改、删除和插入数据
In Entity Framework 4 that's part of .NET 4.0 there is a method on the ObjectContext
ExecuteStoredCommand(string cmdText, object[] parameters)
This allows to execute set based operations directly against your datastore.
In your example you could do something like:
db.ExecuteStoreCommand("DELETE FROM [User] WHERE Sex = '{0}'", new[] {"girl"});
精彩评论