o.sex=\"girl\")" />
开发者

how to extend entity framework ,To achieve this effect

开发者 https://www.devze.com 2023-01-10 00:25 出处:网络
how to extend entity framework ,To achieve this effect db.Users.Delete(o=>o.sex==\"girl\") db.Users.Update(o=>o.sex=\"girl\")

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"});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号