views:

502

answers:

2

Linq to Sql handles every insert/delete/update operation on an object with separate query. Is there a way to unite multiple operations in single query?

I know this is not possible with the default behavior of the framework. I'm looking for an extension method or workaround. I want to use the queries generated by Linq to Sql, not my own queries or stored procedures but unite multiple operations in a single round-trip to the database.

A: 

LINQ to SQL does not give you a way to specify a set-based update/delete against the database. The only alternative that I am aware of is to use use SQL directly, which you can do using the database context object.

Randy

Randy Minder
I don't want to write the query. I want to keep the linq to SQL generated one. I need a workaround to execute multiple operations in a single query.
Branislav Abadjimarinov
+2  A: 

look at this post : http://stackoverflow.com/questions/1952677/how-to-run-a-mass-update-delete-query-in-linq/1953244#1953244

It's a link to how to implement a batch update, batch delete ... hope it helps

pdiddy