I have an entity framework query that, when converted to SQL returns within a second, but when ran through entity framework times out after an hour (!) I tracked it down to the fact that, before executing the actual query, entity framework executes:
set arithabort off
I'm looking for either a way to configure EF not to do this, or for a way to override it.
I have tried the following:
public partial class MyContext : DbContext
{
public MyContext () : base("name=MyContext ")
{
Context.Database.ExecuteSqlCommand("set arithabort on");
}
public DbContext Context
{
get { return this; }
}
}
But this executes just once in the beginning, and gets overridden whenever another query is executed.