/// <summary> /// Invoked by the framework in order to give a chance to /// obtain other services /// </summary> /// <param name="provider">The service proviver</param> public void Service(IServiceProvider provider) { ILoggerFactory loggerFactory = (ILoggerFactory) provider.GetService(typeof(ILoggerFactory)); if (loggerFactory != null) { logger = loggerFactory.Create(typeof(FormHelper)); } IBrowserValidatorProvider validatorProv = (IBrowserValidatorProvider) provider.GetService(typeof(IBrowserValidatorProvider)); if (validatorProv != null) { validatorProvider = validatorProv; } }
/// <summary> /// Configures this FormHelper instance to use the supplied /// web validator to generate field validation. /// </summary> /// <param name="provider">The validation provider.</param> public virtual void UseWebValidatorProvider(IBrowserValidatorProvider provider) { if (provider == null) throw new ArgumentNullException("provider"); ValidatorProvider = provider; }
/// <summary> /// Creates a new instance of the <see cref="BrowserValidationEngine"></see> class. /// </summary> /// <param name="validatorRegistry">The validator registry where the validators are obtained.</param> /// <param name="browserValidatorProvider">The provider that generates client script for the validators.</param> public BrowserValidationEngine(ILocalizedValidatorRegistry validatorRegistry, IBrowserValidatorProvider browserValidatorProvider) { _validatorRegistry = validatorRegistry; _browserValidatorProvider = browserValidatorProvider; }