question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there any way to modify the connection settings (e.g. set ARITHABORT on)

See original GitHub issue

When EF talks to the SQL server, it sets the following settings with the “Audit Login” event (visible in SQL Server Profiler):

-- network protocol: LPC
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

Is there any way to modify these settings before executing a query? In my case, I would like to enable ARITHABORT, since I am using a (apparently broken) stored procedure and with the setting being turned off, I just get a timeout because it never completes.

I tried doing a db.Database.ExecuteSqlCommand("SET ARITHABORT ON;"); before the query but EF resets the connection automatically afterwards restoring its settings.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rowanmillercommented, Nov 17, 2015

EF isn’t explicitly sending this, it’s the underlying SQL Client ADO.NET provider that sets all these transparently to the caller. One option would be to create your DbConnection externally and then pass it to your context.

0reactions
ajcvickerscommented, Mar 18, 2019

@dark2201 You’re probably better off asking in https://github.com/dotnet/corefx (which is where SQLClient lives) or on Stack Overflow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the ramifications of setting ARITHABORT ON for ...
CHANGE DEFAULT CONNECTION OPTION:​​ The following T-SQL enables ARITHABORT without removing any other options that might be set, and without ...
Read more >
Is there any way to modify the connection settings (e.g. set ...
I tried doing a db.Database.ExecuteSqlCommand("SET ARITHABORT ON;"); before the query but EF resets the connection automatically afterwards ...
Read more >
How to make SqlConnection to use "SET ARITHABORT ...
So the first thing to do is ask your dba. And note that this is a connection setting, so setting it when the...
Read more >
SET ARITHABORT (Transact-SQL) - SQL Server
If SET ARITHABORT is OFF, CREATE, UPDATE, INSERT, and DELETE statements on tables with indexes on computed columns or indexed views fail. The...
Read more >
SET ARITHABORT ON - SQL Server Forums
Hi, I need to 'SET ARITHABORT ON' for a stored procedure so that I can update a table with an index on a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found