tags:

views:

505

answers:

1

Hi -

Is there any way to control the "SET" statements that Linq to SQL emits? I see these SET options coming from Linq to SQL in the SQL profiler and it turns out that "set arithabort off" is causing one of our procs to take 45 seconds as opposed to < 1 second.

-- network protocol: TCP/IP
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language us_english
set dateformat mdy
set datefirst 7
set transaction isolation level read committed

Thanks, Jon

+2  A: 

Rather than using the default constructor or passing a connection string, create your own IDbConnection, set whatever options you need, then pass that to your DataContext's constructor.

Adam Robinson
I don't see an option to set arithabort to ON in the SqlConnection object. Any ideas?
Jon Kragh
You should just be able to execute any of those options as a SqlCommand.ExecuteNonQuery()
Adam Robinson
Thanks Adam! - It would be cool to be able to control what Linq emits as well...
Jon Kragh
No problem! If this has answered your question, please don't forget to mark it as the answer! :)
Adam Robinson