To Change the Active Connection String (Not Necessarily with a Transaction)
using (SharedDbConnectionScope scope = new SharedDbConnectionScope("new connectionstring ")) { //do stuff using new connection string} // returns to default provider connection string
To Perform a Transaction With a Shared Connection
using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope()) using (TransactionScope ts = new TransactionScope()) { Product p = new Product(1); p.Title = "new title"; Product p2 = new Product(2); p.Title = "another new title"; // ... p.Save(); p2.Save(); ts.Close(); }
