コード例 #1
0
ファイル: Dao.cs プロジェクト: nowonbun/BlogCompiler
 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;
             }
         }
     }
 }
コード例 #2
0
ファイル: Dao.cs プロジェクト: nowonbun/BlogCompiler
 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;
             }
         }
     }
 }