LinqToSQL2
LinqToSQL2 copied to clipboard
Delete multiple rows directly by Query
Something similar to:
db.SetX.DeleteWhere(b => b.Created < limit && b.Title == "T2.0");
The code to generate the filter is already there. The tricky part is that delete is a bit more complicated with joins than select is. If there are any local entities (do you have those in L2S?) that match the predicate I guess they should be deleted too.
In EFUtilities I decided to have this kind of operations outside the DbContext because they are "power functions" + work differently from the normal workflow. Not sure what would be best.
Good idea!