Support for Other IoC Containers
See original GitHub issueHi all,
Is there any idea about supporting other ioc libraries that popular, fast and meets the requirements as much as Castle Windsor? Such as DryIoc, SimpleInjector, LightInject etc…?
There is a comparison about Ioc Benchmarks and features, as far as i learned from comparison; some of ioc containers have Interceptors, auto wiring, custom life time and so on, that features already used by Abp. See: Ioc Benchmarks and Comparisons
For Ex; Let’s say; If there is an abstraction in CompositionRoot; when we initialize via
IContainer dryIocContainer = new Container();
var bootstrapper = new AbpBootstrapper();
bootstrapper.UseDryIoc(dryIocContainer);
//bootstrapper.UseNinject(ninjectContainer);
//bootstrapper.UseSimpleInjector(simpleInjectorContainer);
bootstrapper.Initialize();
And of course generic IocManager<T>
based on container interface. Such as:
IocManager<IWindsorContainer> //Castle
IocManager<IContainer> //DryIoc
IocManager<Container> //SimpleInjector
IMHO, It might be useful for who wants to use other ioc frameworks.
What do you think about this idea?
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (10 by maintainers)
Top Results From Across the Web
Is it safe to use the same IoC container for your own and ...
All libraries should use the same container so that components can be shared and don't have to be registered twice.
Read more >IoC Containers
IoC Container (a.k.a. DI Container) is a framework for implementing automatic dependency injection. It manages object creation and it's life-time, ...
Read more >Support other IoC containers in dependency injection #4410
Search code, repositories, users, issues, pull requests... · Provide feedback · Saved searches · Support other IoC containers in dependency ...
Read more >What other IoC containers have an IInitializable like feature?
What other IoC containers have an IInitializable like feature? · dependency-injection · inversion-of-control · ioc-container · object-lifetime.
Read more >ASP.NET Core: Using third-party DI/IoC containers
ASP.NET Core supports other containers through simple IServiceProvider interface. This blog post explains how to use other containers with ASP.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hikalkan Is there any update? or moved to newer I want use Autofac in my project (Zero Template). Isn’t possible now?
Hi All,
There are some things need clarification.
Autofac is most popular and new generation DI container. Which is also considered as modern way to dependency injection by some of communities If compared other DI containers such as Windsor, StructureMap so on…
If any support is provided to new DI container, it definetely should be Autofac. But… Abp’s kernel precisely depends runtime registrations. What does it mean? So, Abp’s Module system has three void methods that
PreInitialize
,Initialize
,PostInitialize
. So, we are currently registering and resolving components while project’s bootstrapping time. That means we have a Castle Container that has been built before(internally) and we’re adding new services to it. Windsor provides this feature to us nice way.But, in Autofac these things don’t work like that. If an Autofac container is built, then you absolutely can’t add any services to it. The only way to do is that create a new temproray Container and update existing container with your temproray container. We could say or assume that container-knowledge exchange.
So, approximately one month ago this Container Update operation marked Obsolete, it would be removed in a few year. Thus, in my opinion, we can’t port to Autofac or something similiar DI containers because of our Abp habits.
Discussion: Autofac ContainerBuilder.Update Marked Obsolete https://github.com/autofac/Autofac/issues/811
Autofac Contributos Say: