Dynamic Module Loading (AutoFac Module) and IServiceCollection

105 views
Skip to first unread message

Raj

unread,
Jul 20, 2021, 10:20:03 AM7/20/21
to Autofac
Introducing Autofac to our developement. We have ASP.Net core  and  Custom.Service.Dlls.
Each of them has Autofac module ASp.NET core  loads Autofac Module based on this link http://old.devkimchi.com/2014/09/25/dynamic-module-loading-with-autofac/
All are working as expected. But in our  Dynamic Modules ( custom.Service.dll)  we have to use IServiceCollection.  Lot of configuration goes with IServiceCollection . Is there a way to pass IServiceCollection. Does Autofac has reference to IServiceCollection.

What is the general Guidelines for Dynmaic Autofac Modules with IServiceCollection 

travis...@gmail.com

unread,
Jul 20, 2021, 4:02:57 PM7/20/21
to Autofac
The two concepts don't overlap. You can register things in the Microsoft style with IServiceCollection or you can register things using Autofac syntax including modules, but you can't use IServiceCollection from inside an Autofac module. Autofac doesn't inherently understand Microsoft registration syntax - it's a conversion that happens for you behind the scenes. If recommend you don't try to mix and match.
Reply all
Reply to author
Forward
0 new messages