Subsonic: Using SharedDbConnectionScope together with TransactionScope seems to be broken

两盒软妹~` 提交于 2019-12-01 20:15:42

Found out the problem. The docs on Subsonic appears to be wrong. If I wrap TransactionScope over SharedDbConnectionScope then it works fine. The right way should be:

using (TransactionScope ts = new TransactionScope())
{
    using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope())           
    {
            // update here
    }
}

Edit: As mentioned by firestorm, SharedDbConnectionScope doesn't seem to work in Subsonic 2.2. So the only solution seems to be to install MsDts and don't use SharedDbConnectionScope.

I don't think SharedDbConnectionScope works at all in Subsonic 2.2. The whole idea as far as I can see with the object is that when you use it you don't need to have MsDts installed on the server. I couldn't get this to work at all! When you install MsDts then you don't need SharedDbConnectionScope any more that's why your code works when it gets created after TransactionScope.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!