这是原来的持久容器的类
public class StdPersistenceContainer
![](/Images/OutliningIndicators/None.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
protected ContainerMapping currentMap;
![](/Images/OutliningIndicators/InBlock.gif)
public StdPersistenceContainer()
![](/Images/OutliningIndicators/InBlock.gif)
public StdPersistenceContainer( ContainerMapping initCurrentMap )
![](/Images/OutliningIndicators/InBlock.gif)
public ContainerMapping ContainerMapping{get;set;}
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Insert( PersistableObject insertObject )
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Select( PersistableObject selectObject )
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Update( PersistableObject updateObject )
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Delete( PersistableObject deleteObject )
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/None.gif)
public class StdPersistenceContainer
![](/Images/OutliningIndicators/None.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
protected ContainerMapping currentMap;
![](/Images/OutliningIndicators/InBlock.gif)
public StdPersistenceContainer()
![](/Images/OutliningIndicators/InBlock.gif)
public StdPersistenceContainer( ContainerMapping initCurrentMap )
![](/Images/OutliningIndicators/InBlock.gif)
public ContainerMapping ContainerMapping{get;set;}
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Insert( PersistableObject insertObject )
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Select( PersistableObject selectObject )
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Update( PersistableObject updateObject )
![](/Images/OutliningIndicators/InBlock.gif)
public virtual void Delete( PersistableObject deleteObject )
![](/Images/OutliningIndicators/InBlock.gif)
public static virtual void BeginTransaction() //开始事务
![](/Images/OutliningIndicators/InBlock.gif)
public static virtual void SetAbort() //终止事务并回滚
![](/Images/OutliningIndicators/InBlock.gif)
public static virtual void SetComplete () //提交事务
![](/Images/OutliningIndicators/InBlock.gif)
public static virtual void ExecuteNonQuery(string sqlText) //用硬编码sql语句查询数据库
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
这是我新设计的持久容器的类,加入了手动事务和硬编码sql语句的支持,大家看看还有哪些需要的,最后那几个函数我设计成静态函数不知道合适不合适,大家也给参考参考,不过我感觉事务加到容器里好像不太对,因为一个特定的容器只有CRUD四个方法,把事务加到里面也没有呀,应该些个事务管理的类,来处理多个容器持久化方法的的事务吧,大家都来想想,如何改进咱们的架构,其实我感觉用.NET自带的事务也可以处理,具体示例看你的机器里的以下目录
<SDK>v1.1\Samples\Technologies\ComponentServices\Transactions
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
另外关于并发的处理,请查看以下链接,我想我们的并发处理在存储过程里写就可以了吧。
ms-help://MS.MSDNQTR.2003FEB.2052/cpguide/html/cpconoptimisticconcurrency.htm
解决了事务,并发的问题咱们的架构就先这样定下来了。