protected void Transaction(Action <BlogCompilerContext> action) { using (var context = new BlogCompilerContext()) { using (var transaction = new TransactionScope()) { try { action(context); transaction.Complete(); } catch (Exception e) { throw e; } } } }
protected IList <T> Transaction <T>(Func <BlogCompilerContext, IList <T> > action) { using (var context = new BlogCompilerContext()) { using (var transaction = new TransactionScope()) { try { var ret = action(context); transaction.Complete(); return(ret); } catch (Exception e) { throw e; } } } }