Can there be in whatever way to bulk-remove a lot of objects matching confirmed query in LINQ or LINQ-to-Organizations? The only real references will be able to find are outdated, also it appears silly to iterate over and by hand remove all objects If only to get rid of.

Some time back I authored a 4 part blog series (Parts 1, 2, 3 and 4) covering doing bulk updates (with one command) within the Entity Framework.

As the focus of this series was update, you can certainly make use of the concepts involved to complete remove.

Which means you should have the ability to write something similar to this:

var query = from c in ctx.Customers
            where c.SalesPerson.Email == "..."
            select c;

query.Delete();

All that you should do is implement the Remove() extension method. Begin to see the publish series for hints how...

Hope this can help

Alex

    using (var context = new DatabaseEntities())
    {
        // delete existing records
        context.ExecuteStoreCommand("DELETE FROM YOURTABLE WHERE CustomerID = {0}", customerId);
    }

I understand of DeleteAllOnSubmit approach to data context that will remove all of the records in query. There has to be some optimisation underlying since lots of objects are now being erased. I don't know though.

The Solutions I am seeing listed here are Linq to Sql

DeleteAllOnSubmit is a component of System.Data.Linq and ITable that is Linq to Sql

This can not be completed with Entity Framework.

Getting stated all that I do not possess a solution yet and can publish when I actually do

I am unsure how efficient it might be, but you could attempt something similar to this:

// deletes all "People" with the name "Joe"
var mypeople = from p in myDataContext.People
               where p.Name == "Joe";
               select p;
myDataContext.People.DeleteAllOnSubmit(mypeople);
myDataContext.SubmitChanges();

You can write a saved proc that does the remove and refer to it as from LINQ. A collection-based remove is probably faster overall but when it affects a lot of records you can cause securing issues and you may need a hybrid of looping through teams of records (maybe 2000 at any given time, size is dependent in your database design but 2000 is really a beginning place if you discover the set-based delte takes such a long time it's affecting other utilisation of the table) to complete the remove.