添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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.

I have the same problem with ADO.NET provider setting this. Is there any example of overriding these settings?

https://social.msdn.microsoft.com/Forums/en-US/cf3853f3-0ea1-41b9-987e-9922e5766066/changing-default-set-options-forced-by-net?forum=adodotnetdataproviders

I would like to set ansi_warnings off