Transactions 使用亚音速T4模板从多个表中删除相关记录

Transactions 使用亚音速T4模板从多个表中删除相关记录,transactions,subsonic,delete-record,Transactions,Subsonic,Delete Record,使用模板,如何从事务中的多个表中删除相关记录?使用(TransactionScope TransactionScope=new TransactionScope()) using (TransactionScope transactionScope = new TransactionScope()) { using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope()) { n

使用模板,如何从事务中的多个表中删除相关记录?

使用(TransactionScope TransactionScope=new TransactionScope())
using (TransactionScope transactionScope = new TransactionScope())
{
  using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope())
  {
    new SubSonic.Query.Delete<Person>(new MyDB().Provider)
      .Where(PersonTable.IdColumn).IsEqualTo(1)
      .Execute();

    new SubSonic.Query.Delete<Basket>(new MyDB().Provider)
      .Where(BasketTable.IdColumn).IsEqualTo(1)
      .Execute();

    transactionScope.Complete();
  }
}
{ 使用(SharedDbConnectionScope sharedConnectionScope=new SharedDbConnectionScope()) { 新建亚音速.Query.Delete(新建MyDB().Provider) .Where(PersonTable.IdColumn).IsEqualTo(1) .Execute(); 新建亚音速.Query.Delete(新建MyDB().Provider) .Where(BasketTable.IdColumn).IsEqualTo(1) .Execute(); transactionScope.Complete(); } }