private TransactionContext CreateTransactionContext()
        {
            Microsoft.Transactions.Bridge.EnlistmentOptions enlistmentOptions = this.enlistment.EnlistmentOptions;
            string remoteTransactionId  = this.enlistment.RemoteTransactionId;
            Guid   localTransactionId   = this.enlistment.LocalTransactionId;
            CoordinationContext context = new CoordinationContext(this.state.ProtocolVersion)
            {
                Expires            = (enlistmentOptions.Expires == TimeSpan.MaxValue) ? uint.MaxValue : ((uint)((int)enlistmentOptions.Expires.TotalMilliseconds)),
                Identifier         = remoteTransactionId,
                LocalTransactionId = localTransactionId,
                IsolationLevel     = enlistmentOptions.IsoLevel,
                IsolationFlags     = enlistmentOptions.IsolationFlags,
                Description        = enlistmentOptions.Description
            };
            string contextId = CoordinationContext.IsNativeIdentifier(remoteTransactionId, localTransactionId) ? null : remoteTransactionId;
            string sctId     = null;
            RequestSecurityTokenResponse issuedToken = null;

            if (this.state.Config.PortConfiguration.SupportingTokensEnabled)
            {
                CoordinationServiceSecurity.CreateIssuedToken(localTransactionId, remoteTransactionId, this.state.ProtocolVersion, out issuedToken, out sctId);
            }
            AddressHeader refParam = new WsatRegistrationHeader(localTransactionId, contextId, sctId);

            context.RegistrationService = this.state.RegistrationCoordinatorListener.CreateEndpointReference(refParam);
            return(new TransactionContext(context, issuedToken));
        }
 protected void VerifyAndTraceEnlistmentOptions()
 {
     Microsoft.Transactions.Bridge.EnlistmentOptions enlistmentOptions = this.enlistment.EnlistmentOptions;
     if (enlistmentOptions == null)
     {
         DiagnosticUtility.FailFast("Need EnlistmentOptions for context");
     }
     if (enlistmentOptions.IsoLevel == IsolationLevel.Unspecified)
     {
         DiagnosticUtility.FailFast("Need IsolationLevel for context");
     }
     if (this.enlistment.LocalTransactionId == Guid.Empty)
     {
         DiagnosticUtility.FailFast("Need LocalTransactionId for context");
     }
     if (string.IsNullOrEmpty(this.enlistment.RemoteTransactionId))
     {
         DiagnosticUtility.FailFast("Need RemoteTransactionId for context");
     }
     if (DebugTrace.Info)
     {
         DebugTrace.TxTrace(TraceLevel.Info, this.enlistmentId, "Local transactionId is {0}", this.enlistment.LocalTransactionId);
         DebugTrace.TxTrace(TraceLevel.Info, this.enlistmentId, "Remote transactionId is {0}", this.enlistment.RemoteTransactionId);
         DebugTrace.TxTrace(TraceLevel.Info, this.enlistmentId, "Transaction timeout is {0} seconds", enlistmentOptions.Expires.TotalSeconds);
         DebugTrace.TxTrace(TraceLevel.Info, this.enlistmentId, "Transaction isolation level is {0}", enlistmentOptions.IsoLevel);
     }
 }
 public Microsoft.Transactions.Bridge.EnlistmentOptions CreateEnlistmentOptions(uint expires, bool expiresPresent, IsolationLevel isoLevel, IsolationFlags isoFlags, string description)
 {
     Microsoft.Transactions.Bridge.EnlistmentOptions options = new Microsoft.Transactions.Bridge.EnlistmentOptions {
         Expires  = this.CalculateTimeout(expires, expiresPresent),
         IsoLevel = isoLevel
     };
     if (options.IsoLevel == IsolationLevel.Unspecified)
     {
         options.IsoLevel = IsolationLevel.Serializable;
     }
     options.IsolationFlags = isoFlags;
     options.Description    = description;
     return(options);
 }
 public Microsoft.Transactions.Bridge.EnlistmentOptions CreateEnlistmentOptions(uint expires, bool expiresPresent, IsolationLevel isoLevel, IsolationFlags isoFlags, string description)
 {
     Microsoft.Transactions.Bridge.EnlistmentOptions options = new Microsoft.Transactions.Bridge.EnlistmentOptions {
         Expires = this.CalculateTimeout(expires, expiresPresent),
         IsoLevel = isoLevel
     };
     if (options.IsoLevel == IsolationLevel.Unspecified)
     {
         options.IsoLevel = IsolationLevel.Serializable;
     }
     options.IsolationFlags = isoFlags;
     options.Description = description;
     return options;
 }
 public abstract void CreateTransaction(Enlistment enlistment, EnlistmentOptions enlistmentOptions, TransactionManagerCallback callback, object state);
 public void CreateTransaction(CompletionEnlistment completion, EnlistmentOptions options, MsgCreateTransactionEvent e)
 {
     DebugTrace.Trace(TraceLevel.Info, "Sending CreateTransaction to transaction manager");
     this.propagation.CreateTransaction(completion.Enlistment, options, this.createTransactionResponseCallback, e);
 }
 public void EnlistTransaction(CoordinatorEnlistment coordinator, EnlistmentOptions options, MsgEnlistTransactionEvent e)
 {
     DebugTrace.Trace(TraceLevel.Info, "Sending CreateSuperiorEnlistment to transaction manager");
     this.propagation.CreateSuperiorEnlistment(coordinator.Enlistment, options, this.enlistTransactionResponseCallback, e);
 }