分布式事务管理System.Transactions.TransactionScope

此分布式数据库事务管理需开启 msdtc服务,它是微软分布式传输协调程序http://blog.sina.com.cn/s/blog_53a072c10100towp.html

-----------测试代码-----------  

//需引用 System.Transactions;

 

  //IBatisNetDAL.CustomDAL的db链接设置为|DataDirectory|iBatisDemo_Data.mdf

   Demo.SpringUse.IBLL.IProductBLL productMgr = (Demo.SpringUse.BLL.ProductBLL)
                    Spring.Context.Support.ContextRegistry.GetContext().GetObject("ProductBLL");

   //IBatisNetDAL.ProductDAL的db链接设置为|DataDirectory|Copy of iBatisDemo_Data.MDF

           Demo.SpringUse.IBLL.ICustomBLL customBLLMgr = (Demo.SpringUse.BLL.CustomBLL)
               Spring.Context.Support.ContextRegistry.GetContext().GetObject("CustomBLL");

            IList l1 = productMgr.SelectAll();
            IList l2 = customBLLMgr.SelectAll();


            using (TransactionScope scope = new TransactionScope())
            {
                //http://blog.sina.com.cn/s/blog_53a072c10100towp.html
                //需开启 msdtc.exe服务,它是微软分布式传输协调程序
               Demo.SpringUse.Model.Custom c = newDemo.SpringUse.Model.Custom();
                c.Address = "test1" + DateTime.Now.Ticks;
                c.CustomName = "myname" + DateTime.Now.Ticks;
                c.IsMember = true;

               Demo.SpringUse.Model.Product p = newDemo.SpringUse.Model.Product();
                p.ProductName = "pname"+DateTime.Now.Ticks;
                p.NormalPrice = DateTime.Now.Second;
                p.MemberPrice = DateTime.Now.Minute;

                productMgr.Insert(p);

                customBLLMgr.Insert(c);

                scope.Complete();
            }


            l1 = productMgr.SelectAll();
            l2 = customBLLMgr.SelectAll();

 

-----------------

       //http://blog.sina.com.cn/s/blog_53a072c10100towp.html
                //需开启 msdtc.exe服务,它是微软分布式传输协调程序;
                //oracle数据库须安装相关支持组件
                //http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
                //http://download.oracle.com/otn/other/ole-oo4o/ODTwithODAC1020221.exe

                //ODAC10.2.0.2.21主要包括:
                //a) Oracle Data Provider for .NET 1.x (10.2.0.2.20)
                //b) Oracle Data Provider for .NET 2.0 (10.2.0.2.20)
                //c) Oracle Database Extensions for .NET 1.x (10.2.0.2.20) -- upgrade only
                //d) Oracle Database Extensions for .NET 2.0 (10.2.0.2.20) -- upgrade only
                //e) Oracle Services for Microsoft Transaction Server (10.2.0.1.0)
                //f) Oracle Provider for OLE DB (10.2.0.2.20)
                //g) Oracle Objects for OLE (10.2.0.2.20)
                //h) Oracle Client (10.2.0.1.0)
                //i) Oracle Universal Installer (10.2.0.2.0)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值