Begins a database transaction.
Begins a database transaction with the default isolation level 'ReadCommitted'.
public static void BeginTransaction();
Begins a database transaction with the specified isolation level.
public static void BeginTransaction(IsolationLevel);
Begins a lightweight database transaction. You can also use the TransactionScope approach available in .NET 2.0, but keep in mind that such transactions are always promoted to distributed transactions.
Sample code wrapped in a transaction:
try { BusinessObject.BeginTransaction(); Account account = new Account("Google", AccountType.Business); account.Save() Address address = new Address("55 S. Blue Ave", "San Francisco", "CA", "90000"); address.Save() account.CurrentAddress = address; BusinessObject.CommitTransaction(); } catch (Exception ex) { BusinessObject.RollbackTransaction(); }
BusinessObject Class | Kredor.BO Namespace