Right, the table.Where() returns an IQueryable (which is also an IEnumerable). The DeleteAllOnSubmit() will use this enumerator to get items, and then use them individually to be recorded for deletion. The idea to optimize this would be for the DeleteAllOnSubmit() to identify that is it an IQuerable and that it comes from DbLinq. Then it could get the original criteria and inject them in a simple delete clause.
But there is more complicated: even if not supported now, the Delete() and friends should support cascading: this means when an entity is deleted, all related (and specified) entities are also deleted. So later the optimization should also consider this point to avoid orphan entities. Pascal. jabber/gtalk: [email protected] msn: [email protected] On Wed, Feb 25, 2009 at 19:27, rob <[email protected]> wrote: > > And just to be sure, you are saying at this point the engine doesn't > have such optimizations, correct? > Thanks > > On Feb 25, 8:04 am, Pascal Craponne <[email protected]> wrote: > > Hi Rob, > > thanks for suggestion. Currently, the engine has such optimizations, but > > we're always looking for volunteers. Are you interested in contributing? > > > > Pascal. > > > > > > > > On Wed, Feb 25, 2009 at 16:45, rob <[email protected]> wrote: > > > > > I am performing table.DeleteAllOnSubmit(table.Where(x => x.Foo = > > > "Bar")). I see that the engine is actually retrieving all rows with > > > Foo equal to Bar, and then individually attempting to delete them. Is > > > this normal behaviour? Is there another method I can call that will > > > generate: > > > delete from table where Foo = 'Bar'? > > > Thanks- Hide quoted text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DbLinq" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/dblinq?hl=en -~----------~----~----~----~------~----~------~--~---
