public ValidationResult GetResultFromBehavior(ValidationResultScope scope) { return(Behavior.GetValidationResult( GetContext(), scope )); }
public ValidationResult GetValidationResult(IBehaviorContext context, ValidationResultScope scope) { ValidationResult result = GetValidationResultCore(context, scope); ValidationResult nextResult = this.GetValidationResultNext(context, scope); return(ValidationResult.Join(result, nextResult)); }
public ValidationResult GetValidationResult(IBehaviorContext context, ValidationResultScope scope) { ValidationResult result; return(ReturnedValidationResults.TryGetValue(scope, out result) ? result : ValidationResult.Valid); }
public static ValidationResult GetValidationResultNext( this Behavior behavior, IBehaviorContext context, ValidationResultScope scope ) { IValidationResultAggregatorBehavior next; return(behavior.TryGetBehavior(out next) ? next.GetValidationResult(context, scope) : ValidationResult.Valid); }
public ValidationResult GetValidationResult(IBehaviorContext context, ValidationResultScope scope) { Cache cache; switch (scope) { case ValidationResultScope.All: return(ValidationResult.Join( GetValidationResult(context, ValidationResultScope.Self), GetValidationResult(context, ValidationResultScope.Descendants) )); case ValidationResultScope.Self: return(ValidationResult.Join( GetValidationResult(context, ValidationResultScope.PropertiesOnly), GetValidationResult(context, ValidationResultScope.ViewModelValidationsOnly) )); case ValidationResultScope.Descendants: cache = GetCache(context); if (cache.DescendantResult == null) { cache.DescendantResult = this.GetValidationResultNext(context, scope); } return(cache.DescendantResult); case ValidationResultScope.ViewModelValidationsOnly: cache = GetCache(context); if (cache.ViewModelResult == null) { cache.ViewModelResult = this.GetValidationResultNext(context, scope); } return(cache.ViewModelResult); case ValidationResultScope.PropertiesOnly: cache = GetCache(context); if (cache.PropertyResult == null) { cache.PropertyResult = this.GetValidationResultNext(context, scope); } return(cache.PropertyResult); default: throw new NotSupportedException(); } }
private ValidationResult GetValidationResultCore( IBehaviorContext context, ValidationResultScope scope ) { switch (scope) { case ValidationResultScope.All: return(ValidationResult.Join( GetValidationResultCore(context, ValidationResultScope.Self), GetValidationResultCore(context, ValidationResultScope.Descendants) )); case ValidationResultScope.Self: return(ValidationResult.Join( GetValidationResultCore(context, ValidationResultScope.PropertiesOnly), GetValidationResultCore(context, ValidationResultScope.ViewModelValidationsOnly) )); case ValidationResultScope.Descendants: return(ValidationResult.Join( _descriptor.Properties.Select(x => x .Behaviors .GetDescendantsValidationResultNext(context)) )); case ValidationResultScope.ViewModelValidationsOnly: return(_descriptor .Behaviors .GetValidationResultNext(context)); case ValidationResultScope.PropertiesOnly: return(ValidationResult.Join( _descriptor.Properties.Select(x => x .Behaviors .GetValidationResultNext(context)) )); default: throw new NotSupportedException(); } }
public ValidationResult GetResult(ValidationResultScope scope) { switch (scope) { case ValidationResultScope.All: return(_allResult); case ValidationResultScope.Self: return(_selfResult); case ValidationResultScope.Descendants: return(_childResults.JoinedResult); case ValidationResultScope.ViewModelValidationsOnly: return(_viewModelResult); case ValidationResultScope.PropertiesOnly: return(_propertiesResult); default: throw new NotSupportedException(); } }
public ValidationResult GetValidationResult(IBehaviorContext context, ValidationResultScope scope) { var c = GetCache(context); return(c.GetResult(scope)); }
public ValidationResult GetValidationResult(ValidationResultScope scope = ValidationResultScope.All) { return(_descriptor .Behaviors .GetValidationResultNext(this, scope)); }
public ValidationResult GetValidationResult(IBehaviorContext context, ValidationResultScope scope) { Invocations++; return(this.GetValidationResultNext(context, scope)); }