Exemplo n.º 1
0
        public static IServiceCollection AddVeeValidation(this IServiceCollection services, Action <VeeValidateOptions> optionsExpression = null)
        {
            var expr    = optionsExpression ?? delegate { };
            var options = new VeeValidateOptions();

            expr(options);

            services.TryAddSingleton(options);
            services.TryAddSingleton <VeeValidateSnippets>();
            services.TryAddTransient <IValidationAttributeAdapterProvider, VeeValidateAttributeAdapterProvider>();

            if (options.OverrideValidationTagHelpers)
            {
                services.TryAddSingleton <IHtmlGenerator, VeeValidateHtmlGenerator>();
            }

            return(services);
        }
Exemplo n.º 2
0
 public VeeValidateAttributeAdapterProvider(VeeValidateOptions options)
 {
     _options = options;
 }
Exemplo n.º 3
0
 public VeeValidateSnippets(VeeValidateOptions options)
 {
     _options = options;
 }