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));
        }
Ejemplo n.º 2
0
        public MemoryStream WriteHeader()
        {
            MemoryStream mem = new MemoryStream();

            mem.WriteByte(1);
            if (CoordinationContext.IsNativeIdentifier(this.logEntry.RemoteTransactionId, this.logEntry.LocalTransactionId))
            {
                mem.WriteByte(1);
            }
            else
            {
                mem.WriteByte(0);
                SerializationUtils.WriteString(mem, this.logEntry.RemoteTransactionId);
            }
            Guid localEnlistmentId = this.logEntry.LocalEnlistmentId;

            SerializationUtils.WriteGuid(mem, ref localEnlistmentId);
            return(mem);
        }