Get the autofac container

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 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.

Thanks
6 years ago
Hello,

Not sure but i think engine context is replace by
@inject
keyword.

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

For an example @inject
IProductservice productservice
6 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>();
}
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.