public static void Transaction(IConnectionContext cc, Action <IConnectionContext> handler) { using (cc) { cc.BeginTransaction(); handler(cc); cc.Commit(); } }
public static void Transaction(string name, Action <IConnectionContext> handler) { using (IConnectionContext cc = DbContext.Get(name)) { cc.BeginTransaction(); handler(cc); cc.Commit(); } }