Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Is the Structuremap DI based on Episerver Abstraction finsihed or under development?

$
0
0

I am reading in the documentation for Episerver 9.5 that we should use the Episerver abstraction layer when doing DI configuration (http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Initialization/dependency-injection/). I tried to use this new approach but I lack some methods that I have when I talk directly with Structure map. For instance, see the example below. Here the first code block uses the Structure map's container for doing configuration. The second code block uses the Episerver abstraction class(es) but here I lack the .Ctor<T>(string) option. I also lack some other configuration options but I think you see my point. My question is: Is the abstraction layer "complete" or are you aware of this and it will be implemented in future versions? (I guess this question is best answered by Episerver employees). 

[InitializableModule]
    public class DIConfiguration : IConfigurableModule
    {
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            var container = context.Container;
            container.Configure(x => 
            {
                x.For<StandardPageController>().Use<StandardPageController>()
                    .Ctor<ICalculatorService>("calculatorService").Is<CalculatorService>()
                    .Ctor<ICalculatorService>("superCalculatorService").Is<SuperCalculatorService>();
            });
            context.Services.Configure(x =>
            {
                x.For<StandardPageController>().Use<StandardPageController>()
                    .Ctor<ICalculatorService>("calculatorService").Is<CalculatorService>()
                    .Ctor<ICalculatorService>("superCalculatorService").Is<SuperCalculatorService>();
            });
        }
        public void Initialize(InitializationEngine context)
        {
        }
        public void Uninitialize(InitializationEngine context)
        {
        }
    }

Thanks for answering!


Viewing all articles
Browse latest Browse all 9076

Trending Articles