Skip to content
alastairs edited this page Mar 31, 2012 · 2 revisions

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
Clone this wiki locally