Exemplo n.º 1
0
        public static ESTransactionContext CreateContext(TransactionAffinity affinity)
        {
            switch(affinity)
            {
                case TransactionAffinity.RequiresNew:
                    return new RequiresNewTransactionContext();

                case TransactionAffinity.Required:
                    return new RequiredTransactionContext();

                case TransactionAffinity.Supported:
                    return new SupportedTransactionContext();

                case TransactionAffinity.NotSupported:
                    return new NotSupportedTransactionContext();

                default:
                    throw new TransactionContextException("Invalid affinity(" + affinity.ToString() + ". Mapping failed.");
            }
        }
Exemplo n.º 2
0
 public ESTransactionContext CreateContext(TransactionAffinity affinity)
 {
     return ESTransactionHandler.CreateContext(affinity);
 }
        public static TransactionContext GetContext(TransactionAffinity transactionAffinity)
        {
            TransactionContext ctx = null;

            switch(transactionAffinity)
            {
                case TransactionAffinity.RequiresNew:
                    ctx = new RequiresNewTransactionContext();
                    break;
                case TransactionAffinity.Required:
                    ctx = new RequiredTransactionContext();
                    break;
                case TransactionAffinity.Supported:
                    ctx = new SupportedTransactionContext();
                    break;
                case TransactionAffinity.NotSupported:
                    ctx = new NotSupportedTransactionContext();
                    break;
                default:
                    throw new TransactionContextException(transactionAffinity.ToString() + "is not currently supported.");
            }

            if(ContextCreated != null)
                ContextCreated(null, new TCCreatedEventArgs(ctx));

            return ctx;
        }
 public static TransactionContext EnterContext(TransactionAffinity transactionAffinity)
 {
     TransactionContext ctx = GetContext(transactionAffinity);
     ctx.Enter();
     return ctx;
 }