nopCommerce 4.2 Validation is not working while plugin assembly is not start with "Nop"

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
I have raised the issue regarding fluent validation not being registered on github: https://github.com/nopSolutions/nopCommerce/issues/3960
4 years ago
ysheah wrote:
Finally I am able to solve this, just add line below to your ConfigureServices where you inherit INopStartup in your custom plugin, it will solve the issue:

    //register validator
    services.AddTransient<IValidator<CustomRegisterModel>, RegisterValidator>();



overall code will be as below:

/// <summary>
        /// Add and configure any of the middleware
        /// </summary>
        /// <param name="services">Collection of service descriptors</param>
        /// <param name="configuration">Configuration root of the application</param>
        //public void ConfigureServices(IServiceCollection services, IConfigurationRoot configuration)
        public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
          

            //register validator
            services.AddTransient<IValidator<CustomRegisterModel>, RegisterValidator>();


        }


Hey, This is working perfectly.
Thank you for sharing.
4 years ago
davidandrewpowell wrote:
I have raised the issue regarding fluent validation not being registered on github: https://github.com/nopSolutions/nopCommerce/issues/3960


Great!!
Let’s wait for an update from nop team.
2 years ago
rajupaladiya wrote:
Finally I am able to solve this, just add line below to your ConfigureServices where you inherit INopStartup in your custom plugin, it will solve the issue:

    //register validator
    services.AddTransient<IValidator<CustomRegisterModel>, RegisterValidator>();



overall code will be as below:

/// <summary>
        /// Add and configure any of the middleware
        /// </summary>
        /// <param name="services">Collection of service descriptors</param>
        /// <param name="configuration">Configuration root of the application</param>
        //public void ConfigureServices(IServiceCollection services, IConfigurationRoot configuration)
        public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
          

            //register validator
            services.AddTransient<IValidator<CustomRegisterModel>, RegisterValidator>();


        }

Hey, This is working perfectly.
Thank you for sharing.



Hi,

is there a solution for this in version 4.40?
This solution does not seem to work and if I have read that correctly, NopCommercere will not create a solution either.

Best regards
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.