// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Linq; namespace Microsoft.AspNet.Mvc.ModelBinding { /// /// Default implementation for . /// public class CompositeModelValidatorProvider : ICompositeModelValidatorProvider { /// /// Initializes a new instance of . /// /// The instance used to get the list of /// activated that this instance delegates to. public CompositeModelValidatorProvider(IModelValidatorProviderProvider provider) { ValidatorProviders = provider.ModelValidatorProviders; } public IReadOnlyList ValidatorProviders { get; private set; } public IEnumerable GetValidators(ModelMetadata metadata) { return ValidatorProviders.SelectMany(v => v.GetValidators(metadata)); } } }