Exemplo n.º 1
0
 protected DisposableContainer ConditialNewContext(out MainContext context)
 {
     if (connectNeed)
         context = Context == null ? CommonHelper.CreateMainContext() : Context;
     else context = null;
     var result = new DisposableContainer();
     result.DisposeNeed = connectNeed && Context == null;
     result.Object = context;
     return result;
 }
Exemplo n.º 2
0
 protected void ConditionalContextSave(DisposableContainer contextContainer)
 {
     if (contextContainer.DisposeNeed)
         CommonHelper.SaveContextChanges(contextContainer.Object as MainContext);
 }
Exemplo n.º 3
0
 protected void ConditionalTransactionComplete(DisposableContainer transactionContainer)
 {
     if (transactionContainer.DisposeNeed)
         (transactionContainer.Object as TransactionScope).Complete();
 }
Exemplo n.º 4
0
 protected DisposableContainer ConditialNewTransaction(out TransactionScope transaction)
 {
     if (connectNeed)
         transaction = Transaction == null ? CommonHelper.CreateTransaction() : Transaction;
     else transaction = null;
     var result = new DisposableContainer();
     result.DisposeNeed = connectNeed && Transaction == null;
     result.Object = transaction;
     return result;
 }