c# - Unable to begin a distributed transaction using Entiy Framework -
i'm having following error executing piece of code:
private bool _updatelist(sysinfo _sysinfo, list<plist> _plist) { try { foreach (var p in _plist) { _context.spupdateplistapprovalflow(p.countryid, _sysinfo.user.jobroleid, p.src, p.id, p.status, _sysinfo.user.username); } return true; } catch (exception ex) //debug { throw; //throws error main try catch } }
error
the operation not performed because ole db provider "msdasql" linked server "as400_linkedsrv" unable begin distributed transaction.
however, works fine when run stored procedure in sql management studio:
exec [dbo].[spupdateplistapprovalflow] @countryid = 123456, @usertypeid = 23456, @src = 1, @id = '123456789', @status = 30, @username = 'username'
i'm tired of digging answer nothing works... few things i've tried:
- set transaction isolation level read uncommitted
- insert multiple transactions in stored procedure
this sp has 2 sub stored procedures on it. 1 writes table of application's database, , updates table in as400.
ok, after half day trying solve i've solved it.
resolution
downgraded entity framework 6 entity framework 5 , distribuited transactions error has gone.
just pay attention, if you're going this, have change usings in code. ( in auto generated code in data model well)
ef 6 uses
using system.data.entity.core.objects
ef 5 uses
using system.data.objects;
Comments
Post a Comment