Пример #1
0
        public void Handle(PlaceSalesOrder command)
        {
            var order = _context.Get(command.Id);

            order.PlaceOrder();
            _context.SaveAndPublishEvents(order);
        }
 /// <summary>
 /// Gets contextual information about the compensation destination
 /// </summary>
 /// <param name="messageHandlerContext">The message handler context</param>
 /// <returns>The compensation destination context</returns>
 public static CompensationRoutingContext GetCompensationContext(this IMessageHandlerContext messageHandlerContext)
 {
     return(messageHandlerContext.Get <CompensationRoutingContext>());
 }
 /// <summary>
 /// Gets contextual information about the next destination
 /// </summary>
 /// <param name="messageHandlerContext">The message handler context</param>
 /// <returns>The next destination context</returns>
 public static RoutingContext GetNextDestinationContext(this IMessageHandlerContext messageHandlerContext)
 {
     return(messageHandlerContext.Get <RoutingContext>());
 }
 /// <summary>
 /// Gets contextual information about the reply destination
 /// </summary>
 /// <param name="messageHandlerContext">The message handler context</param>
 /// <returns>The reply destination context</returns>
 public static ReplyToRoutingContext GetReplyContext(this IMessageHandlerContext messageHandlerContext)
 {
     return(messageHandlerContext.Get <ReplyToRoutingContext>());
 }
 /// <summary>
 /// Gets contextual information about the transaction the message broker is a part of
 /// </summary>
 /// <param name="messageHandlerContext">The message handler context</param>
 /// <returns>The transaction context</returns>
 public static TransactionContext GetTransactionContext(this IMessageHandlerContext messageHandlerContext)
 {
     return(messageHandlerContext.Get <TransactionContext>());
 }
Пример #6
0
        ///// <summary>
        ///// Gets contextual information about a message broker from message handler context
        ///// </summary>
        ///// <param name="messageHandlerContext">The message handler context</param>
        ///// <returns>The message broker context</returns>
        //public static MessageBrokerContext AsMessageBrokerContext(this IMessageHandlerContext messageHandlerContext)
        //    => messageHandlerContext as MessageBrokerContext;

        /// <summary>
        /// Gets contextual information about the transaction the message broker is a part of
        /// </summary>
        /// <param name="messageHandlerContext">The message handler context</param>
        /// <returns>The transaction context</returns>
        public static TransactionContext GetTransactionContext(this IMessageHandlerContext messageHandlerContext)
        => messageHandlerContext.Get <TransactionContext>();