0
使用模板,如何從事務中的多個表中刪除相關記錄?使用subsonic T4模板從多個表中刪除相關記錄
使用模板,如何從事務中的多個表中刪除相關記錄?使用subsonic T4模板從多個表中刪除相關記錄
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();
}
}