Пример #1
0
        //Adds the durable instance context information to the
        //outgoing messages.
        protected void ApplyContext(Message message)
        {
            IContextManager contextManager =
                ContextManagerFactory.CreateContextManager(contextType,
                                                           this.contextStoreLocation,
                                                           this.endpointAddress);

            contextManager.WriteContext(message);
        }
Пример #2
0
        //Reads the durable instance context id from the incoming
        //messages.
        protected string ReadContextId(Message message)
        {
            IContextManager contextManager =
                ContextManagerFactory.CreateContextManager(contextType,
                                                           this.contextStoreLocation,
                                                           this.endpointAddress);

            string contextId = contextManager.ReadContext(message);

            if (contextId == null)
            {
                throw new CommunicationException(
                          ResourceHelper.GetString("ExContextNotFound"));
            }

            // Add the context id to the properties collection of the Message.
            // This way we can pass the context id to the service model layer in a
            // consistent manner regardless of the context type.
            message.Properties.Add(DurableInstanceContextUtility.ContextIdProperty, contextId);

            return(contextId);
        }