Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryHandlerBase{TQuery}" /> class.
        /// </summary>
        /// <param name="queryContract">The query contract.</param>
        /// <param name="commandContract">The command contract.</param>
        /// <param name="nextQueryHandler">The next query handler in the chain.</param>
        /// <param name="defaultQueryResponse">The default query response.</param>
        /// <param name="messageHandlerResolver">The message handler resolver.</param>
        protected QueryHandlerBase(
            IQueryContract queryContract,
            ICommandContract commandContract,
            IQueryHandler nextQueryHandler,
            TQuery defaultQueryResponse,
            IServerMessageHandlerResolver messageHandlerResolver)
        {
            this.response = defaultQueryResponse;
            this.messageHandlerResolver = messageHandlerResolver;

            nextQueryHandler.AddHandler(this);

            queryContract.QuerySubmitted += this.OnQuerySubmitted;

            commandContract.MessagePublished  += this.OnMessagePublished;
            commandContract.MessageSubscribed += this.OnMessageSubscribed;
        }