Wednesday, February 1, 2012

Tranctions in nettiers / Tranctions in net tiers


TransactionManager tm = DataRepositor.Provider.CreateTransaction(); 
tm.BeginTransaction();
DataRepositor.Provider.OrderProvider.Save(tm, order);
foreach(OrderDetail detail in order.OrderDetailCollection)
{
  detail.OrderId = order.Id; // get the new order.Id
}
DataRepositor.Provider.OrderDetailProvider.Save(tm,
order.order.OrderDetailCollection);

tm.RollBack();

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software