NServiceBus.Sending.Setup C# (CSharp) Method

Setup() protected method

protected Setup ( FeatureConfigurationContext context ) : void
context FeatureConfigurationContext
return void
        protected internal override void Setup(FeatureConfigurationContext context)
        {
            var transport = context.Settings.Get<OutboundTransport>();
            var lazySendingConfigResult = new Lazy<TransportSendInfrastructure>(() => transport.Configure(context.Settings), LazyThreadSafetyMode.ExecutionAndPublication);
            context.Container.ConfigureComponent(c =>
            {
                var dispatcher = lazySendingConfigResult.Value.DispatcherFactory();
                return dispatcher;
            }, DependencyLifecycle.SingleInstance);

            context.RegisterStartupTask(new PrepareForSending(lazySendingConfigResult));
        }