public void Validate(object value, IValidationReport report, ValidationReportDepth depth) { if (value == null) { return; } foreach (var invoker in _invokerRegistry.GetInvokers(value.GetType())) { invoker.Invoke(value, report, depth); if (report.HasErrors && depth == ValidationReportDepth.ShortCircuit) { return; } } }
private IInvokerRegistry CreateInvokerRegistry(IInvokerRegistry baseRegistry, Type[] types) { var result = new InvokerRegistry(); var includeAll = (types == null) || (types.Length == 0); foreach (var invoker in baseRegistry.GetInvokers()) { if (includeAll || types.Contains(invoker.ParameterType)) { result.RegisterInvoker(invoker); } } return(result); }