Branislav Abadjimarinov
Branislav Abadjimarinov

Reputation: 5131

How to insert/update/delete multiple objects with a single query in Linq to Sql

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.

Upvotes: 3

Views: 2311

Answers (2)

pdiddy
pdiddy

Reputation: 6297

look at this post : How to run a mass update/delete query in Linq?

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

Upvotes: 2

Randy Minder
Randy Minder

Reputation: 48442

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

Upvotes: 0

Related Questions