博客园中转

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Deleting

All Delete[...] methods return the number of records deleted.

DeleteBy[...]

Simple.Data:

db.Users.DeleteById(1);

SQL:

DELETE FROM [Users] WHERE [Users].[Id] = @p1

Delete (using Named Arguments)

Simple.Data:

db.Users.Delete(Id: 1);

SQL:

DELETE FROM [Users] WHERE [Users].[Id] = @p1

DeleteAll

Simple.Data:

// Caution here!
db.Users.DeleteAll();

SQL:

DELETE FROM [Users]

Simple.Data:

db.Users.DeleteAll(db.Users.Age > 42);

SQL:

DELETE FROM [Users] WHERE [Age] > @p1
posted on 2012-04-29 09:00  pieux  阅读(210)  评论(0编辑  收藏  举报