None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 лет назад
I am developing a new plugin with Data access in Widget section.


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'
8 лет назад
It should be ILocalizationService instead of LocalizationService. You should use the interface instead of the actual class. ;)
8 лет назад
Many many thanks wooncherk :)


You saved me.. can not believe that i just spent 2 days for this silly mistake (just an 'I'  made me crazy)

really appreciate your hawk eyes, thanks again :)
8 лет назад
No problem. Glad it helped. :)
3 года назад
My solution for me was that in the IRepository <Payment Option>

The instance reference was to Nop.Core.Data and it should be to Nop.Data

I was like this for 2 days too
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.