I'm in a situation where I want to add the equivalent of the sql statement
SET QUERY_GOVERNOR_COST_LIMIT
to my query I created with linq to entities.
How would I go about that?
I'm in a situation where I want to add the equivalent of the sql statement
SET QUERY_GOVERNOR_COST_LIMIT
to my query I created with linq to entities.
How would I go about that?
You can create a connection yourself, execute the statement, wrap the connection in a EntityConnection
and that as parameter to the ObjectContext
constructor. This way the ObjectContext
is executed within the context of that connection.
var conn = ((EntityConnection)Context.Connection).StoreConnection;
Also, in EF 4 you can do Context.ExecuteStoreQuery