I've two plugin.
In first plugin I've service named "MyWebHelper"
(Plugin.My.Service.MyWebHelper)
And I'm using this service in another plugin.
In nopCommerce 3.9, it not required for register in dependency.
But in 4.0, it throws exception without dependency register.
So I tried to register it in second plugins DependencyRegister via below code, but it trowing exception.
Dependency Register
builder.RegisterType<MyWebHelper>().As<IMyWebHelper>().InstancePerLifetimeScope();
also tried with
// Services
builder.RegisterAssemblyTypes(typeof(IMyWebHelper).Assembly)
//.Where(t => t.Name.EndsWith("Service"))
.AsImplementedInterfaces()
.InstancePerRequest();
Alos tried with
builder.RegisterType<MyWebHelper>().As<IMyWebHelper>().InstancePerLifetimeScope().
// WithParameter(ResolvedParameter.ForNamed<HttpContextBase>("nop_cache_static"));
My service constructor
public partial class MyWebHelper : IMyWebHelper
{
private readonly HttpContextBase _httpContext;
/// <summary>
/// Ctor
/// </summary>
/// <param name="httpContext">HTTP context</param>
public MyWebHelper(HttpContextBase httpContext)
{
this._httpContext = httpContext;
}
}
And error message is
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = SolrWebHelper (ReflectionActivator), Services = [Plugin.My.Service.MyWebHelper], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Plugin.My.Service.MyWebHelper' can be invoked with the available services and parameters:
Cannot resolve parameter 'System.Web.HttpContextBase httpContext' of constructor 'Void .ctor(System.Web.HttpContextBase)'. (See inner exception for details.)
Anyone have idea where I'm doing wrong?