Validation : No constructor was found that had all the dependencies satisfied

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 лет назад
I have this problem with validation, where adding this line
[Validator(typeof(PublicAfilliatePageValidator))]
to the top of the model, causes an error.

Model:
using FluentValidation.Attributes;
using Nop.Plugin.Marketing.AffiliateProgram.Validators;
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;
using Nop.Web.Models.Common;

namespace Nop.Plugin.Marketing.AffiliateProgram.Models
{
    [Validator(typeof(PublicAfilliatePageValidator))]
    public class PublicAfilliatePageModel : BaseNopModel
    {
        [NopResourceDisplayName("Plugins.Marketing.AffiliateProgram.Fields.Active")]
        public bool Active { get; set; }

        [NopResourceDisplayName("Plugins.Marketing.AffiliateProgram.Fields.Url")]
        public string Url { get; set; }

        [NopResourceDisplayName("Plugins.Marketing.AffiliateProgram.Fields.FriendlyUrlName")]
        public string FriendlyUrlName { get; set; }

        [NopResourceDisplayName("Plugins.Marketing.AffiliateProgram.Fields.Credit")]
        public decimal Credit { get; set; }

        [NopResourceDisplayName("Plugins.Marketing.AffiliateProgram.Fields.CreditNextPayment")]
        public decimal CreditNextPayment { get; set; }

        [NopResourceDisplayName("Plugins.Marketing.AffiliateProgram.Fields.Iban")]
        public string Iban { get; set; }

        public AddressModel Address { get; set; }
    }
}


Validator
using FluentValidation;
using Nop.Core.Domain.Customers;
using Nop.Plugin.Marketing.AffiliateProgram.Models;
using Nop.Services.Localization;

namespace Nop.Plugin.Marketing.AffiliateProgram.Validators
{
    public class PublicAfilliatePageValidator : AbstractValidator<PublicAfilliatePageModel>
    {
        PublicAfilliatePageValidator(ILocalizationService localizationService,
            CustomerSettings customerSettings)
        {
            RuleFor(x => x.Iban).NotEmpty().WithMessage(localizationService.GetResource("trewtwer"));
            RuleFor(x => x.FriendlyUrlName).NotEmpty().WithMessage(localizationService.GetResource("fsefse"));
        }
    }
}


Source error: https://pastebin.com/9vqrFjV7

Stacktrace: https://pastebin.com/ZLzCSwcD
6 лет назад
bump
6 лет назад
Have you found the error? Because I have the same problem now.

It works on my local machine but on production server throws an error.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.