Closed moh-hassan closed 4 years ago
If there are other strategies you want to employ to locate plugins, that's not something Autofac supports. Autofac doesn't even do the assembly loading, if you notice - all that assembly resolving handler stuff is .NET Core.
While we have a simple example there to show one possible way to handle plugins, Autofac isn't a plugin framework and we're not really prepared to take on recommendations around things like assembly loading safety, how to handle per-plugin dependencies, differences in how .NET Framework and .NET Core handle assembly loading, and so on. That's, unfortunately, going to be an exercise left to the reader. Sorry.
I suggested this scenario because I found autofac documentation explain plugin topic for asp.net mvc as part of application integration.
Yep, which, unfortunately is yet another way to handle plugins (for ASP.NET MVC "classic" rather than ASP.NET Core). Different frameworks, different app types, different loading mechanisms... we just can't be responsible for showing folks how to do it because there is a lot to consider from security to dependency management and isolation. The best we can offer is a couple quick examples, but any more is beyond what we are able to support for our users. Again, we're a DI library, not a plugin framework, though I recognize there is a desire to overlap the two concepts.
The demo
ConfigurationExample
define both internal and external dependencies using a configuration fileautofac.json
In other scenarios, the plugins are loaded in external folder like a tree and are not defined at compile time. plugin folder Example:So, autofac load the plugins from the assemblies in the plugin folder and manage its dependencies. It's nice if we have a demo for such scenario