public static void ContributeLifecycleListener <TComponent>(this IComponentContainerBuilder containerBuilder)
     where TComponent : ILifecycleListenerComponent
 {
     containerBuilder.RegisterComponentType <TComponent>()
     .SingleInstance()
     .ForService <ILifecycleListenerComponent>();
 }
Example #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            foreach (var feature in _containedFeatures)
            {
                feature.ContributeComponents(existingComponents, newComponents);
            }
        }
 public override void ContributeConfigSections(IComponentContainerBuilder newComponents)
 {
     if (_s_featureLoaderMocks.TryGetValue(this.GetType(), out FeatureLoaderMock mock))
     {
         mock.ContributeConfigSections(newComponents);
     }
 }
Example #4
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public void ContributeConfigSections(IComponentContainerBuilder newComponents)
        {
            foreach (var feature in _containedFeatures)
            {
                feature.ContributeConfigSections(newComponents);
            }
        }
Example #5
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public static void ContributeMessageProtocol <TProtocol>(this IComponentContainerBuilder containerBuilder)
            where TProtocol : MessageProtocol
        {
            containerBuilder.RegisterComponentType <TProtocol>()
            .SingleInstance()
            .ForService <MessageProtocol>();
        }
        public override void ContributeConfigSections(IComponentContainerBuilder newComponents)
        {
            base.ContributeConfigSections(newComponents);

            newComponents
            .RegisterComponentInstance(new ConfigSection_MessagingPlatformConfiguration())
            .ForService <IMessagingPlatformConfiguration>();
        }
Example #7
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public static void ContributePortBExample(this IComponentContainerBuilder containerBuilder, string value)
        {
            containerBuilder.RegisterComponentInstance <PortsAndAdaptersPoc.ExamplePortB>(
                new PortsAndAdaptersPoc.ExamplePortB(containerBuilder)
            {
                Value = value
            }
                );
        }
 public HttpEndpointInjectorPort(
     IComponentContainerBuilder containerBuilder,
     string name,
     Action <IHttpEndpointConfig> onConfiguration,
     Func <HttpContext, Task> onRequest)
     : base(containerBuilder)
 {
     this.Name            = name;
     this.OnConfiguration = onConfiguration;
     this.OnRequest       = onRequest;
 }
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        private void ContributeCompiledTxHandlers(IComponentContainer input, IComponentContainerBuilder output)
        {
            //var handlerObjectFactory = input.Resolve<ITxResourceHandlerObjectFactory>();

            //foreach (var txType in _allTxTypes)
            //{
            //    var handlerList = handlerObjectFactory.CreateResourceHandlerList(txType);

            //    foreach (var handlerType in handlerList.GetHandlerTypes())
            //    {
            //        output.RegisterComponentType(handlerType).ForService<IRestResourceHandler>();
            //    }
            //}
        }
Example #10
0
        public static HttpEndpointInjectorPort ContributeHttpEndpoint(
            this IComponentContainerBuilder containerBuilder,
            string name,
            int?listenPortNumber = null,
            Action <IHttpEndpointConfig> onConfiguration = null,
            Func <HttpContext, Task> onRequest           = null)
        {
            if (listenPortNumber.HasValue)
            {
                onConfiguration += (http) => {
                    http.Port = listenPortNumber.Value;
                };
            }

            var port = new HttpEndpointInjectorPort(containerBuilder, name, onConfiguration, onRequest);

            containerBuilder.RegisterComponentInstance <HttpEndpointInjectorPort>(port);
            return(port);
        }
            //-------------------------------------------------------------------------------------------------------------------------------------------------

            public override void ContributeCompiledComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
            {
                OnContributeCompiledComponents?.Invoke(_featureLoaderType, existingComponents, newComponents);
            }
            //-------------------------------------------------------------------------------------------------------------------------------------------------

            public override void ContributeConfigSections(IComponentContainerBuilder newComponents)
            {
                OnContributeConfigSections?.Invoke(_featureLoaderType, newComponents);
            }
Example #13
0
 public static IComponentRegistrationBuilder ContributeTransactionScript <TComponent>(this IComponentContainerBuilder containerBuilder)
     where TComponent : class
 {
     return(containerBuilder.RegisterComponentType <TComponent>().InstancePerDependency());
 }
Example #14
0
        public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            newComponents.RegisterComponentType <TypeLibrary <IRuntimeTypeFactoryArtifact> >()
            .SingleInstance()
            .ForService <ITypeLibrary <IRuntimeTypeFactoryArtifact> >();

            newComponents.RegisterComponentType <VoidTypeFactoryBackend>()
            .SingleInstance()
            .ForService <ITypeLibrary <IRuntimeTypeFactoryArtifact> >()
            .AsFallback();
        }
Example #15
0
 public static void ContributeTypeFactory <TTypeFactory, TObjectFactory>(this IComponentContainerBuilder containerBuilder)
     where TTypeFactory : class, TObjectFactory, ITypeFactory
 {
     containerBuilder.RegisterComponentType <TTypeFactory>().SingleInstance().ForService <TObjectFactory>();
 }
Example #16
0
 protected AbstractUIAppInjectorPort(IComponentContainerBuilder containerBuilder, Type appComponentType)
     : base(containerBuilder)
 {
     this.AppComponentType = appComponentType;
 }
 public override void ContributeCompiledComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
 {
     newComponents.RegisterComponentType <CompileRegistered>().ForService <ICompileRegistered>();
     base.ContributeCompiledComponents(existingComponents, newComponents);
 }
Example #18
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        private void OnRegisterHostComponents(IComponentContainerBuilder containerBuilder)
        {
            containerBuilder.RegisterComponentInstance <MicroserviceHostBuilder>(this);
        }
Example #19
0
        public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            newComponents.RegisterComponentType <RoslynTypeFactoryBackend>()
            .SingleInstance()
            .ForService <ITypeFactoryBackend <IRuntimeTypeFactoryArtifact> >();

            //containerBuilder.Register<ITypeFactoryBackend<IRuntimeTypeFactoryArtifact>, RoslynTypeFactoryBackend>(LifeStyle.Singleton);
        }
        public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            base.ContributeComponents(existingComponents, newComponents);

            newComponents.RegisterComponentType <DefaultInvocationScheduler>()
            .SingleInstance()
            .ForService <IInvocationScheduler>()
            .AsFallback();
        }
Example #21
0
 public virtual void ContributeConfigSections(IComponentContainerBuilder newComponents)
 {
 }
Example #22
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public virtual void ContributeCompiledComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
        }
Example #23
0
        public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            base.ContributeComponents(existingComponents, newComponents);

            newComponents.RegisterComponentType <RestApiService>()
            .SingleInstance()
            .ForService <IRestApiService>();
        }
Example #24
0
        public override void ContributeAdapterComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            base.ContributeCompiledComponents(existingComponents, newComponents);

            var allPorts = existingComponents.ResolveAll <HttpEndpointInjectorPort>();

            foreach (var port in allPorts)
            {
                port.ConfigureHttpEndpoint(existingComponents);

                newComponents.RegisterComponentType <KestrelHttpEndpoint>()
                .WithParameter <HttpEndpointInjectorPort>(port)
                .SingleInstance()
                .ForServices <IEndpoint, ILifecycleListenerComponent>();
            }
        }
            //-----------------------------------------------------------------------------------------------------------------------------------------------------

            public override void ContributeCompiledComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
            {
                if (_s_featureLoaderMocks.TryGetValue(this.GetType(), out FeatureLoaderMock mock))
                {
                    mock.ContributeCompiledComponents(existingComponents, newComponents);
                }
            }
Example #26
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        internal void ApplyComponentContributions(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            foreach (var contributor in _componentContributions)
            {
                contributor(existingComponents, newComponents);
            }
        }
Example #27
0
 public WebAppInjectorPort(IComponentContainerBuilder containerBuilder, Type appComponentType, string uriPathBase)
     : base(containerBuilder, appComponentType)
 {
     this.UriPathBase = uriPathBase;
 }
        //-------------------------------------------------------------------------------------------------------------------------------------------------

        public override void ContributeCompiledComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            base.ContributeCompiledComponents(existingComponents, newComponents);

            var handlerList1 = new TxResourceHandlerList_of_HelloWorldTx(); // this instantation will be handled by TxResourceHandlerTypeFactory

            foreach (var handlerType in handlerList1.GetHandlerTypes())
            {
                newComponents.RegisterComponentType(handlerType).ForService <IResourceHandler>();
            }
        }
Example #29
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        private void RegisterHostComponents(IComponentContainerBuilder containerBuilder)
        {
            _hostComponents?.Invoke(containerBuilder);
        }
Example #30
0
 public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
 {
     newComponents.ContributeLifecycleListener <MicroserviceHostSmokeTest.SmokeTestComponent>();
 }