Visibility of Funq from asp.net core

Hi - I’m pretty sure I know the answer, but I’m just asking in case I am missing something.

I have an SS app which is “shared” across various places by an IPlugin implementation.

I’m looking to implement Workflow core to provide workflow capability. The Workflow steps get their depenedencies from the Asp.net Core IServiceProvider.

This obviously doesn’t know about anything in Funq. Is there any out of the box way of sharing these registrations?

Current plan is either a) re-wire both to use an IOC container they can both use e.g. Autofac or b) call HostContext.TryResolve from within the steps, but I don’t think this would be testable?

Any guidance gratefully received.

If you register your dependencies in the ASP .NET Core IOC they’re accessible to both ASP .NET Core and ServiceStack.

There’s also Modular Startup support where your plugins could implement IConfigureServices and register any dependencies in their Configure(IServiceCollection services) but you’d need to be aware that ServiceStack will auto register all IConfigureServices it scans for, (i,e. not just if the Plugin is loaded) as the ASP .NET Core dependencies need to be registered before the AppHost is initialized (so there’s no way to determine which plugins are loaded before then). But if you only scan assemblies for plugins you want to load there shouldn’t be any issue.

1 Like