EF6 with "inability to start a distributed transaction"

I have several websites running on a server. These nodes access the local database, and the database calls a stored procedure on the linked server.

All websites are working fine except those now running Entity Framework 6.1.1.

When the call is complete, we get an error: The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "___" was unable to begin a distributed transaction.

Code running at this point is autogenerated using the .tt file ...

return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("procname", param1, param2, param3, param4);

      

As mentioned, this works with older versions of EF. (This is not a MSDTC configuration issue.)

On this page ( Working with Transactions (EF6 Onwards) ):

Starting with EF6 Database.ExecuteSqlCommand (), by default, a command in a transaction will be completed if it was not already present. There are overloads of this method that allow you to override this behavior if you like. Also in EF6, executing stored procedures that are included in the model through an API, such as ObjectContext.ExecuteFunction () , does the same (except that the default behavior cannot be overridden at this time ).

I am stuck? Do I need to go back to Entity Framework 5?

+3


source to share





All Articles