Beispiel #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);
        }
Beispiel #2
0
 public VeeValidateAttributeAdapterProvider(VeeValidateOptions options)
 {
     _options = options;
 }
Beispiel #3
0
 public VeeValidateSnippets(VeeValidateOptions options)
 {
     _options = options;
 }