使用模板,如何从事务中的多个表中删除相关记录?
问问题
425 次
1 回答
2
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();
}
}
于 2009-11-27T11:10:49.327 回答