weikio / PluginFramework

Everything is a Plugin in .NET
MIT License
549 stars 105 forks source link

Resolve dependencies in Plugin #48

Closed satishviswanathan closed 3 years ago

satishviswanathan commented 3 years ago

The plugins that I have created is having some dependencies being injected via the constructor of the plugin.

In my application I'm using Autofac as the container and I have created an extension method which will scan the location where I have my plugins and registers the dependencies to the container. The scanning and registration seems to be working but due to some reason when I'm trying to get the plugin by tag i'm getting an error that the dependencies of the plugin cannot be resolved.

I just want to check if this is possible , if so am I missing something. Also it would be helpful if there is examples that I can check it out.

Any help is highly appreciated !

satishviswanathan commented 3 years ago

@mikoskinen Do you think I'm missing something or is it a bug?

satishviswanathan commented 3 years ago

No it's not an issue. I have created an extension method which would scan and register the Autofac modules. What i was missing was when the assembly is loaded it needs to be loaded into the Default assembly context. With that change it worked!