Exemple #1
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();
        }
Exemple #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public static void ContributeMessageProtocol <TProtocol>(this IComponentContainerBuilder containerBuilder)
            where TProtocol : MessageProtocol
        {
            containerBuilder.RegisterComponentType <TProtocol>()
            .SingleInstance()
            .ForService <MessageProtocol>();
        }
 public static void ContributeLifecycleListener <TComponent>(this IComponentContainerBuilder containerBuilder)
     where TComponent : ILifecycleListenerComponent
 {
     containerBuilder.RegisterComponentType <TComponent>()
     .SingleInstance()
     .ForService <ILifecycleListenerComponent>();
 }
Exemple #4
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 <RestApiService>()
            .SingleInstance()
            .ForService <IRestApiService>();
        }
        public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
        {
            base.ContributeComponents(existingComponents, newComponents);

            newComponents.RegisterComponentType <DefaultInvocationScheduler>()
            .SingleInstance()
            .ForService <IInvocationScheduler>()
            .AsFallback();
        }
        //-------------------------------------------------------------------------------------------------------------------------------------------------

        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>();
            }
        }
            public override void ContributeAdapterComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
            {
                base.ContributeAdapterComponents(existingComponents, newComponents);

                var allPortsA = existingComponents.ResolveAll <ExamplePortA>();

                foreach (var port in allPortsA)
                {
                    newComponents.RegisterComponentType <ExampleAdapterA>()
                    .WithParameter <ExamplePortA>(port)
                    .SingleInstance()
                    .ForServices <IExampleAdapterA, ILifecycleListenerComponent>();
                }

                var allPortsB = existingComponents.ResolveAll <ExamplePortB>();

                foreach (var port in allPortsB)
                {
                    newComponents.RegisterComponentType <ExampleAdapterB>()
                    .WithParameter <ExamplePortB>(port)
                    .SingleInstance()
                    .ForServices <IExampleAdapterB, ILifecycleListenerComponent>();
                }
            }
Exemple #9
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 ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
            {
                newComponents.RegisterComponentType <NonStaticTestRequestHandler>().InstancePerDependency();

                newComponents.ContributeHttpEndpoint(
                    "Static",
                    onRequest: null);

                newComponents.ContributeHttpEndpoint(
                    "Dynamic",
                    onRequest: context => {
                    var handler = existingComponents.Resolve <NonStaticTestRequestHandler>();
                    return(handler.HandleRequest(context));
                });

                newComponents.ContributeHttpEndpoint(
                    "Mixed",
                    onRequest: context => {
                    var handler = existingComponents.Resolve <NonStaticTestRequestHandler>();
                    return(handler.HandleRequest(context));
                });
            }
 public override void ContributeCompiledComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
 {
     newComponents.RegisterComponentType <CompileRegistered>().ForService <ICompileRegistered>();
     base.ContributeCompiledComponents(existingComponents, newComponents);
 }
Exemple #12
0
 public static IComponentRegistrationBuilder ContributeTransactionScript <TComponent>(this IComponentContainerBuilder containerBuilder)
     where TComponent : class
 {
     return(containerBuilder.RegisterComponentType <TComponent>().InstancePerDependency());
 }
Exemple #13
0
 public static void ContributeTypeFactory <TTypeFactory, TObjectFactory>(this IComponentContainerBuilder containerBuilder)
     where TTypeFactory : class, TObjectFactory, ITypeFactory
 {
     containerBuilder.RegisterComponentType <TTypeFactory>().SingleInstance().ForService <TObjectFactory>();
 }
 public override void ContributeComponents(IComponentContainer existingComponents, IComponentContainerBuilder newComponents)
 {
     base.ContributeComponents(existingComponents, newComponents);
     newComponents.RegisterComponentType <ExampleDependency>().SingleInstance();//typeof(ExampleDependency), LifeStyle.Singleton);
 }