I get the following error
Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.
When I try to do the following
using (DataOneContext context1 = new DataOneContext())
{
code...
using (DataTwoContext context2 = new DataTwoContext())
{
more code...
}
}
When I separate them, the code works. But to have things simple, it'd be easier for one to be in the other. Is it possible?
I would like to avoid enabling MSDTC.
DataOneContext and DataTwoContext are the tables in the DBML file (sorry I don't know the technical term).
Each context is conne开发者_如何学运维cting to a different server.
I think you can do this by sharing the connection (assuming the same server). Transactions automatically get promoted to distributed transactions when they use different connections.
using (DataOneContext context1 = new DataOneContext())
{
code...
using (DataTwoContext context2 = new DataTwoContext(context1.Connection))
{
more code....
}
}
精彩评论