/// <summary>Register IAsyncRequestHandler[TRequest, TResponse](includes All) to container builder.</summary> public static DiContainer BindAsyncRequestHandler <TRequest, TResponse, THandler>(this DiContainer builder, MessagePipeOptions options) where THandler : IAsyncRequestHandler { var lifetime = options.InstanceLifetime; var services = new DiContainerProxy(builder); services.Add(typeof(IAsyncRequestHandlerCore <TRequest, TResponse>), typeof(THandler), lifetime); if (!builder.HasBinding <IAsyncRequestHandler <TRequest, TResponse> >()) { services.Add(typeof(IAsyncRequestHandler <TRequest, TResponse>), typeof(AsyncRequestHandler <TRequest, TResponse>), lifetime); services.Add(typeof(IAsyncRequestAllHandler <TRequest, TResponse>), typeof(AsyncRequestAllHandler <TRequest, TResponse>), lifetime); } return(builder); }
/// <summary>Register IPublisher[TKey, TMessage] and ISubscriber[TKey, TMessage](includes Async) to container builder.</summary> public static DiContainer BindMessageBroker <TKey, TMessage>(this DiContainer builder, MessagePipeOptions options) { var lifetime = options.InstanceLifetime; var services = new DiContainerProxy(builder); // keyed PubSub services.Add(typeof(MessageBrokerCore <TKey, TMessage>), lifetime); services.Add(typeof(IPublisher <TKey, TMessage>), typeof(MessageBroker <TKey, TMessage>), lifetime); services.Add(typeof(ISubscriber <TKey, TMessage>), typeof(MessageBroker <TKey, TMessage>), lifetime); // keyed PubSub async services.Add(typeof(AsyncMessageBrokerCore <TKey, TMessage>), lifetime); services.Add(typeof(IAsyncPublisher <TKey, TMessage>), typeof(AsyncMessageBroker <TKey, TMessage>), lifetime); services.Add(typeof(IAsyncSubscriber <TKey, TMessage>), typeof(AsyncMessageBroker <TKey, TMessage>), lifetime); return(builder); }