Speedy.Data will automatically manage connections and transactions for you. To begin a transaction, instantiate a SpeedyScope inside a using statement:

If you set up a SpeedyScope inside another SpeedyScope using the default constructors, the inner SpeedyScope will take on the outer SpeedyScope's connection and transaction. We refer to this outer transaction as the "ambient" transaction. If you don't want this to happen, you can instantiate your inner SpeedyScopes with an optional TransactionScopeOption:
TransactionScopeOption.RequiresNew Sets up a new transaction totally independent of the ambient transaction.
TransactionScopeOption.Suppress Executes any queries totally outside of any transaction.
Example:
//1) No Transaction
personNoTransaction.Insert();
//Instantiating a Service Scope creates a new transaction.
//ALWAYS instantiate SpeedyScopes within using statements! This
//allows Speedy.Data to automatically manage your connections and transactions!
//2) Simple transaction. We'll call this the outer transaction.
// It will be committed at the end of the using statement.
using (SpeedyScope scope = new SpeedyScope())
{
//3) Ambient transaction - if you instantiate a SpeedyScope within another
// SpeedyScope, it will be considered part of the transaction of the
// first SpeedyScope.
using (SpeedyScope separateScope = new SpeedyScope())
{
personAmbientTransaction.Insert();
//Commits the transaction.
separateScope.Complete();
}
//4) New Transaction - if you instantiate a SpeedyScope with the RequiresNew
// TransactionScopeOption, a new transaction will be used, not the outer, ambient
// transaction.
using (SpeedyScope separateScope2 = new SpeedyScope(TransactionScopeOption.RequiresNew))
{
personNewTransaction.Insert();
//Commits the transaction.
separateScope2.Complete();
}
//5) Suppressed transaction - if you instantiate a SpeedyScope with the Suppress
// TransactionScopeOption, the operations inside it will not be transacted at all,
// even if there's an outer, ambient transaction.
using (SpeedyScope separateScope3 = new SpeedyScope(TransactionScopeOption.Suppress))
{
personSuppressedTransaction.Insert();
//Commits the transaction.
separateScope3.Complete();
}
//The insert for the outer transaction (#2)
personOuterTransaction.Insert();
//Commits the transaction for #2 and any ambient sub-transactions (in this case, #3).
scope.Complete();
}