Skip to content
Adam Schroder edited this page Feb 2, 2015 · 11 revisions

Doco coming soon

Query

UpdateMany

Update all of type T using a Where if necessary

var list = new[] {1, 2, 3, 4};

// Update only the Name field using the template User passed 
// into Execute where the UserId in (1,2,3,4)
// If you turn ExecuteDefaults on it won't 
// set default properties (eg. null, or 0 for int)
db.UpdateMany<User>()
    .Where( x => x.UserId.In(list))
    //.ExcludeDefaults()
    .OnlyFields(x => x.Name)
    .Execute(new User() {Name = "test"});

DeleteMany

Delete all of type T using a Where if necessary

var list = new[] {1, 2, 3, 4};

db.DeleteMany<User>()
    .Where(x => list.Contains(x.UserId))
    .Execute();