Exemplo n.º 1
0
        public static void Set(System.Transactions.Transaction transaction, Message message)
        {
            TransactionMessageProperty propertyAndThrowIfAlreadySet = GetPropertyAndThrowIfAlreadySet(message);

            propertyAndThrowIfAlreadySet.flowedTransaction = transaction;
            message.Properties.Add("TransactionMessageProperty", propertyAndThrowIfAlreadySet);
        }
Exemplo n.º 2
0
        internal static void Set(TransactionInfo transactionInfo, Message message)
        {
            TransactionMessageProperty propertyAndThrowIfAlreadySet = GetPropertyAndThrowIfAlreadySet(message);

            propertyAndThrowIfAlreadySet.flowedTransactionInfo = transactionInfo;
            message.Properties.Add("TransactionMessageProperty", propertyAndThrowIfAlreadySet);
        }
        static internal void Set(TransactionInfo transactionInfo, Message message)
        {
            TransactionMessageProperty property = GetPropertyAndThrowIfAlreadySet(message);

            property.flowedTransactionInfo = transactionInfo;
            message.Properties.Add(PropertyName, property);
        }
        static public void Set(Transaction transaction, Message message)
        {
            TransactionMessageProperty property = GetPropertyAndThrowIfAlreadySet(message);

            property.flowedTransaction = transaction;
            message.Properties.Add(PropertyName, property);
        }
        private void ReadTransactionFromMessage(Message message, TransactionFlowOption txFlowOption)
        {
            TransactionInfo transactionInfo = null;

            try
            {
                transactionInfo = this.formatter.ReadTransaction(message);
            }
            catch (TransactionException exception)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Error);
                this.FaultOnMessage(message, System.ServiceModel.SR.GetString("SFxTransactionDeserializationFailed", new object[] { exception.Message }), "TransactionHeaderMalformed");
            }
            if (transactionInfo != null)
            {
                TransactionMessageProperty.Set(transactionInfo, message);
            }
            else if (txFlowOption == TransactionFlowOption.Mandatory)
            {
                this.FaultOnMessage(message, System.ServiceModel.SR.GetString("SFxTransactionFlowRequired"), "TransactionHeaderMissing");
            }
        }
Exemplo n.º 6
0
        void ReadTransactionFromMessage(Message message, TransactionFlowOption txFlowOption)
        {
            TransactionInfo transactionInfo = null;

            try
            {
                transactionInfo = this.formatter.ReadTransaction(message);
            }
            catch (TransactionException e)
            {
                DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                FaultOnMessage(message, SR.GetString(SR.SFxTransactionDeserializationFailed, e.Message), FaultCodeConstants.Codes.TransactionHeaderMalformed);
            }

            if (transactionInfo != null)
            {
                TransactionMessageProperty.Set(transactionInfo, message);
            }
            else if (txFlowOption == TransactionFlowOption.Mandatory)
            {
                FaultOnMessage(message, SR.GetString(SR.SFxTransactionFlowRequired), FaultCodeConstants.Codes.TransactionHeaderMissing);
            }
        }
Exemplo n.º 7
0
        internal MessageRpc(RequestContext requestContext, Message request, DispatchOperationRuntime operation,
            ServiceChannel channel, ServiceHostBase host, ChannelHandler channelHandler, bool cleanThread,
            OperationContext operationContext, InstanceContext instanceContext, EventTraceActivity eventTraceActivity)
        {
            Fx.Assert((operationContext != null), "System.ServiceModel.Dispatcher.MessageRpc.MessageRpc(), operationContext == null");
            Fx.Assert(channelHandler != null, "System.ServiceModel.Dispatcher.MessageRpc.MessageRpc(), channelHandler == null");

            this.Activity = null;
            this.EventTraceActivity = eventTraceActivity;            
            this.AsyncResult = null;
            this.CanSendReply = true;
            this.Channel = channel;
            this.channelHandler = channelHandler;
            this.Correlation = EmptyArray.Allocate(operation.Parent.CorrelationCount);
            this.CorrelationCallback = null;
            this.DidDeserializeRequestBody = false;
            this.TransactionMessageProperty = null;
            this.TransactedBatchContext = null;
            this.Error = null;
            this.ErrorProcessor = null;
            this.FaultInfo = new ErrorHandlerFaultInfo(request.Version.Addressing.DefaultFaultAction);
            this.HasSecurityContext = false;
            this.Host = host;
            this.Instance = null;
            this.MessageRpcOwnsInstanceContextThrottle = false;
            this.NextProcessor = null;
            this.NotUnderstoodHeaders = null;
            this.Operation = operation;
            this.OperationContext = operationContext;
            this.paused = false;
            this.ParametersDisposed = false;
            this.ReceiveContext = null;
            this.Request = request;
            this.RequestContext = requestContext;
            this.RequestContextThrewOnReply = false;
            this.SuccessfullySendReply = false;
            this.RequestVersion = request.Version;
            this.Reply = null;
            this.ReplyTimeoutHelper = new TimeoutHelper();
            this.SecurityContext = null;
            this.InstanceContext = instanceContext;
            this.SuccessfullyBoundInstance = false;
            this.SuccessfullyIncrementedActivity = false;
            this.SuccessfullyLockedInstance = false;
            this.switchedThreads = !cleanThread;
            this.transaction = null;
            this.InputParameters = null;
            this.OutputParameters = null;
            this.ReturnParameter = null;
            this.isInstanceContextSingleton = InstanceContextProviderBase.IsProviderSingleton(this.Channel.DispatchRuntime.InstanceContextProvider);
            this.invokeContinueGate = null;

            if (!operation.IsOneWay && !operation.Parent.ManualAddressing)
            {
                this.RequestID = request.Headers.MessageId;
                this.ReplyToInfo = new RequestReplyCorrelator.ReplyToInfo(request);
            }
            else
            {
                this.RequestID = null;
                this.ReplyToInfo = new RequestReplyCorrelator.ReplyToInfo();
            }

            this.HostingProperty = AspNetEnvironment.Current.GetHostingProperty(request, true);

            if (DiagnosticUtility.ShouldUseActivity)
            {
                this.Activity = TraceUtility.ExtractActivity(this.Request);
            }

            if (DiagnosticUtility.ShouldUseActivity || TraceUtility.ShouldPropagateActivity)
            {
                this.ResponseActivityId = ActivityIdHeader.ExtractActivityId(this.Request);
            }
            else
            {
                this.ResponseActivityId = Guid.Empty;
            }

            this.InvokeNotification = new MessageRpcInvokeNotification(this.Activity, this.channelHandler);

            if (this.EventTraceActivity == null && FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
            {
                if (this.Request != null)
                {
                    this.EventTraceActivity = EventTraceActivityHelper.TryExtractActivity(this.Request, true);
                }
            }
        }
 internal MessageRpc(System.ServiceModel.Channels.RequestContext requestContext, Message request, DispatchOperationRuntime operation, ServiceChannel channel, ServiceHostBase host, ChannelHandler channelHandler, bool cleanThread, System.ServiceModel.OperationContext operationContext, System.ServiceModel.InstanceContext instanceContext)
 {
     this.Activity                   = null;
     this.AsyncResult                = null;
     this.CanSendReply               = true;
     this.Channel                    = channel;
     this.channelHandler             = channelHandler;
     this.Correlation                = EmptyArray.Allocate(operation.Parent.CorrelationCount);
     this.CorrelationCallback        = null;
     this.DidDeserializeRequestBody  = false;
     this.TransactionMessageProperty = null;
     this.TransactedBatchContext     = null;
     this.Error              = null;
     this.ErrorProcessor     = null;
     this.FaultInfo          = new ErrorHandlerFaultInfo(request.Version.Addressing.DefaultFaultAction);
     this.HasSecurityContext = false;
     this.Host     = host;
     this.Instance = null;
     this.MessageRpcOwnsInstanceContextThrottle = false;
     this.NextProcessor        = null;
     this.NotUnderstoodHeaders = null;
     this.Operation            = operation;
     this.OperationContext     = operationContext;
     this.paused                     = false;
     this.ParametersDisposed         = false;
     this.ReceiveContext             = null;
     this.Request                    = request;
     this.RequestContext             = requestContext;
     this.RequestContextThrewOnReply = false;
     this.SuccessfullySendReply      = false;
     this.RequestVersion             = request.Version;
     this.Reply = null;
     this.ReplyTimeoutHelper              = new TimeoutHelper();
     this.SecurityContext                 = null;
     this.InstanceContext                 = instanceContext;
     this.SuccessfullyBoundInstance       = false;
     this.SuccessfullyIncrementedActivity = false;
     this.SuccessfullyLockedInstance      = false;
     this.switchedThreads                 = !cleanThread;
     this.transaction                = null;
     this.InputParameters            = null;
     this.OutputParameters           = null;
     this.ReturnParameter            = null;
     this.isInstanceContextSingleton = InstanceContextProviderBase.IsProviderSingleton(this.Channel.DispatchRuntime.InstanceContextProvider);
     this.invokeContinueGate         = null;
     if (!operation.IsOneWay && !operation.Parent.ManualAddressing)
     {
         this.RequestID   = request.Headers.MessageId;
         this.ReplyToInfo = new System.ServiceModel.Channels.RequestReplyCorrelator.ReplyToInfo(request);
     }
     else
     {
         this.RequestID   = null;
         this.ReplyToInfo = new System.ServiceModel.Channels.RequestReplyCorrelator.ReplyToInfo();
     }
     this.HostingProperty = AspNetEnvironment.Current.PrepareMessageForDispatch(request);
     if (DiagnosticUtility.ShouldUseActivity)
     {
         this.Activity = TraceUtility.ExtractActivity(this.Request);
     }
     if (DiagnosticUtility.ShouldUseActivity || TraceUtility.ShouldPropagateActivity)
     {
         this.ResponseActivityId = ActivityIdHeader.ExtractActivityId(this.Request);
     }
     else
     {
         this.ResponseActivityId = Guid.Empty;
     }
     this.InvokeNotification = new MessageRpcInvokeNotification(this.Activity, this.channelHandler);
 }