Ejemplo n.º 1
0
        public void Validate(ModelBindingExecutionContext modelBindingExecutionContext, ModelValidationNode parentNode)
        {
            if (modelBindingExecutionContext == null)
            {
                throw new ArgumentNullException("modelBindingExecutionContext");
            }

            if (SuppressValidation)
            {
                // no-op
                return;
            }

            // pre-validation steps
            ModelValidatingEventArgs eValidating = new ModelValidatingEventArgs(modelBindingExecutionContext, parentNode);

            OnValidating(eValidating);
            if (eValidating.Cancel)
            {
                return;
            }

            ValidateChildren(modelBindingExecutionContext);
            ValidateThis(modelBindingExecutionContext, parentNode);

            // post-validation steps
            ModelValidatedEventArgs eValidated = new ModelValidatedEventArgs(modelBindingExecutionContext, parentNode);

            OnValidated(eValidated);
        }
Ejemplo n.º 2
0
        private void OnValidating(ModelValidatingEventArgs e)
        {
            EventHandler <ModelValidatingEventArgs> handler = Validating;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        public void Validate(ModelBindingExecutionContext modelBindingExecutionContext, ModelValidationNode parentNode) {
            if (modelBindingExecutionContext == null) {
                throw new ArgumentNullException("modelBindingExecutionContext");
            }

            if (SuppressValidation) {
                // no-op
                return;
            }

            // pre-validation steps
            ModelValidatingEventArgs eValidating = new ModelValidatingEventArgs(modelBindingExecutionContext, parentNode);
            OnValidating(eValidating);
            if (eValidating.Cancel) {
                return;
            }

            ValidateChildren(modelBindingExecutionContext);
            ValidateThis(modelBindingExecutionContext, parentNode);

            // post-validation steps
            ModelValidatedEventArgs eValidated = new ModelValidatedEventArgs(modelBindingExecutionContext, parentNode);
            OnValidated(eValidated);
        }
 private void OnValidating(ModelValidatingEventArgs e) {
     EventHandler<ModelValidatingEventArgs> handler = Validating;
     if (handler != null) {
         handler(this, e);
     }
 }