we are currently upgrading our plugin from nopCommerce version 3.80 and 4.00. We have one function, that needs to run in Thread (data transfer from/to our ERP).
In 3.80 we used:
using (var scope = EngineContext.Current.ContainerManager.Container.BeginLifetimeScope())
{
...
}
In 4.00 is missing EngineContext.Current.ContainerManager, so i tried to inject ILifetimeScope, but it fails, when you use EngineContext.Current.Resolve<TService>, GetServiceProvider() returns null. When i don't use ILifetimeScope, it offen fails in DbContext has been disposed exception.
Some advices, how correctly use threads?
Thanks Martin.