Managing ArithAbort in EF4

We have some performance issues with our EF4 MVC solution. We were able to track it before ArithAbort was installed in front of all database connections, and now we are trying to make it remain 'ON'.

We looked: How do you control the "SET" statements issued by Linq to SQL

But it seems that EF4 drops the connection before each request, so this will not work.

So far, we have tried to β€œset ArithAbort on” before this request, with no luck. We also tried to go a long way and create a new connection, where we established it, but still no luck.

So, does anyone know how we can install it before making any linq queries to the database?

Changing database settings is not an option.

Edit: At the suggestion of Andiihs, I tried the shell solution and added the EFCachingCommand class to the following lines of code

protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) { if (this.WrappedCommand.CommandType == System.Data.CommandType.Text) { this.WrappedCommand.CommandText = "set arithabort on; " + this.WrappedCommand.CommandText; } 

This essentially ensures that any Linq-sql calls get a prefix with the correct set statement.

I also had to add:

  DbFunctionCommandTree functionTree = commandTree as DbFunctionCommandTree; if (functionTree != null) { this.IsModification = true; return; } 

To the GetAffectedEntitySets function in EFCachingCommandDefinition to make it work correctly with stored procedure calls.

+4
source share
1 answer

EF provides the ability to insert a cover provider between Entity Connection and SQL.Data.Client - see http://code.msdn.microsoft.com/EFProviderWrappers and http://blogs.msdn.com/b/jkowalski/archive/2009/ 06/11 / tracing-and-caching-in-entity-framework-available-on-msdn-code-gallery.aspx

Now I admit that this is more of a key than an answer, but maybe you can insert the appropriate set at this point?

+4
source

All Articles