// Copyright (c) .NET Foundation. 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.Web.Http.Controllers; using System.Web.Http.Metadata; using System.Web.Http.ModelBinding; namespace System.Web.Http.Validation { /// /// Context passed between methods. /// public class BodyModelValidatorContext { public BodyModelValidatorContext(ModelStateDictionary modelState) { if (modelState == null) { throw new ArgumentNullException("modelState"); } KeyBuilders = new Stack(); ModelState = modelState; Visited = new HashSet(ReferenceEqualityComparer.Instance); } /// /// Gets or sets the used to provide the model metadata. /// public ModelMetadataProvider MetadataProvider { get; set; } /// /// Gets or sets the within which the model is being validated. /// public HttpActionContext ActionContext { get; set; } /// /// Gets or sets the . /// public IModelValidatorCache ValidatorCache { get; set; } /// /// Gets the current . /// public ModelStateDictionary ModelState { get; private set; } /// /// Gets the set of model objects visited in this validation. Includes the model being validated in the /// current scope. /// public HashSet Visited { get; private set; } /// /// Gets the stack of s used in this validation. Includes /// the to generate model state keys for the current scope. /// public Stack KeyBuilders { get; private set; } /// /// Gets or sets the model state prefix for the root scope of this validation. /// public string RootPrefix { get; set; } } }