I have registered my service using a dependencyregistrar file which is located on my own plugin project.
public virtual void Register(Autofac.ContainerBuilder builder, Core.Infrastructure.ITypeFinder typeFinder)
{
builder.RegisterType<DodSliderService>().As<IDodSliderService>().InstancePerLifetimeScope().PreserveExistingDefaults();
//data context
this.RegisterPluginDataContext<DodSliderObjectContext>(builder, "nop_object_context_dodslider");
//override required repository with our custom context
builder.RegisterType<EfRepository<DodSliderObject>>()
.As<IRepository<DodSliderObject>>()
.WithParameter(ResolvedParameter.ForNamed<IDbContext>("nop_object_context_dodslider"))
.InstancePerLifetimeScope();
}
Controller section
-------------------
public class WidgetDodSliderController : BasePluginController
{
private readonly IDodSliderService _dodSliderService;
private readonly LocalizationService _localizationService;
private readonly IPluginFinder _pluginFinder;
public WidgetDodSliderController(
IDodSliderService dodSliderService,
LocalizationService localizationService,
IPluginFinder pluginFinder)
{
this._dodSliderService = dodSliderService;
this._localizationService = localizationService;
this._pluginFinder = pluginFinder;
}
I am able to install it successfully, but when trying to 'CONFIGURE' , it gives my below error: (This is driving my crazy from 2 days, really appreciable if anyone can help me)
None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Nop.Plugin.Widgets.DodSlider.Controllers.WidgetDodSliderController' can be invoked with the available services and parameters:
Cannot resolve parameter 'Nop.Services.Localization.LocalizationService localizationService' of constructor 'Void .ctor(Nop.Plugin.Widgets.DodSlider.Services.IDodSliderService, Nop.Services.Localization.LocalizationService, Nop.Core.Plugins.IPluginFinder)'.
Searched for almost all sites
p.s: followed the same things as in 'Nop.Plugin.Feed.Froogle'