Is there any way to modify the connection settings (e.g. set ARITHABORT on)
See original GitHub issueWhen 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:
- Created 8 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.@dark2201 You’re probably better off asking in https://github.com/dotnet/corefx (which is where SQLClient lives) or on Stack Overflow.