此分布式数据库事务管理需开启 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)