Skip to content

Commit

Permalink
call filter pipeline for AddSimpleInjector (#17)
Browse files Browse the repository at this point in the history
* call filter pipeline for AddSimpleInjector
fixes #16

* call add simpleinjector after ConfigureServices
(MVC setup may be required)
  • Loading branch information
fw2568 authored Aug 11, 2020
1 parent 188f06e commit 2a1b50b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class AddSimpleInjectorModuleServicesFilter : IModuleServicesFilter
public Action<IModulesHostBuilderContext, IServiceCollection> Invoke(Action<IModulesHostBuilderContext, IServiceCollection> next) =>
(context, services) =>
{
next(context, services);

if (context.Advanced.RootContext is ISimpleInjectorModuleContext containerContext)
{
services.AddSimpleInjector(containerContext.Container, options =>
Expand All @@ -23,12 +25,11 @@ public Action<IModulesHostBuilderContext, IServiceCollection> Invoke(Action<IMod
{
ModuleMethodInvoker.CallOptionalMethod(containerContext, "AddSimpleInjector", o);

});
})(context, options);

});
}

next(context, services);
};
}
}

0 comments on commit 2a1b50b

Please sign in to comment.