/// <summary> /// Binds the instance errors. /// </summary> /// <param name="validatorExposer">The validator exposer.</param> /// <param name="binder">The binder.</param> /// <param name="instance">The instance.</param> protected virtual void BindInstanceErrors(IValidatorAccessor validatorExposer, IDataBinder binder, object instance) { if (instance != null) { validatorExposer.BoundInstanceErrors[instance] = binder.ErrorList; } }
/// <summary> /// Populates the validator error summary. /// </summary> /// <param name="validatorExposer">The validator exposer.</param> /// <param name="binder">The binder.</param> /// <param name="instance">The instance.</param> protected virtual void PopulateValidatorErrorSummary(IValidatorAccessor validatorExposer, IDataBinder binder, object instance) { if (validate) { validatorExposer.PopulateValidatorErrorSummary(instance, binder.GetValidationSummary(instance)); } }
/// <summary> /// Configures the validator. /// </summary> /// <param name="validatorExposer">The validator exposer.</param> /// <param name="binder">The binder.</param> protected virtual void ConfigureValidator(IValidatorAccessor validatorExposer, IDataBinder binder) { if (validate && validatorExposer == null) { throw new MonoRailException("DataBind wants to validate, but controller does not seem to implement IValidatorAccessor interface"); } if (validate) { binder.Validator = validatorExposer.Validator; } else { binder.Validator = null; } }
/// <summary> /// Binds the instance errors. /// </summary> /// <param name="validatorExposer">The validator exposer.</param> /// <param name="binder">The binder.</param> /// <param name="instance">The instance.</param> protected virtual void BindInstanceErrors(IValidatorAccessor validatorExposer, IDataBinder binder, object instance) { if (instance != null) { validatorExposer.BoundInstanceErrors[instance] = binder.ErrorList; } }
/// <summary> /// Populates the validator error summary. /// </summary> /// <param name="validatorExposer">The validator exposer.</param> /// <param name="binder">The binder.</param> /// <param name="instance">The instance.</param> protected virtual void PopulateValidatorErrorSummary(IValidatorAccessor validatorExposer, IDataBinder binder, object instance) { if (validate) { validatorExposer.PopulateValidatorErrorSummary(instance, binder.GetValidationSummary(instance)); } }
/// <summary> /// Configures the validator. /// </summary> /// <param name="validatorExposer">The validator exposer.</param> /// <param name="binder">The binder.</param> protected virtual void ConfigureValidator(IValidatorAccessor validatorExposer, IDataBinder binder) { if (validate && validatorExposer == null) { throw new MonoRailException("DataBind wants to validate, but controller does not seem to implement IValidatorAccessor interface"); } if (validate) { binder.Validator = validatorExposer.Validator; } else { binder.Validator = null; } }