Get the autofac container

2 years ago
Is there a way to get the current container for autofac in nopCommerce 4? I've found some info on EngineContext.Current.ContainerManager, but that is apparently no long in the code.

Or maybe another way to create a new lifetime scope to keep something seperate.

2 years ago

Not sure but i think engine context is replace by

Nop currently use that keyword at view page in version 4.0.

For an example @inject
IProductservice productservice
2 years ago
I got it by adding an ILifetimeScope to the constructor then I could do

using (var scope = lifetimeScope.BeginLifetimeScope())
     var anInstance = scope.Resolve<SomeType>();