forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBodyModelValidatorContext.cs
More file actions
65 lines (55 loc) · 2.43 KB
/
Copy pathBodyModelValidatorContext.cs
File metadata and controls
65 lines (55 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// 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
{
/// <summary>
/// Context passed between <see cref="DefaultBodyModelValidator"/> methods.
/// </summary>
public class BodyModelValidatorContext
{
public BodyModelValidatorContext(ModelStateDictionary modelState)
{
if (modelState == null)
{
throw new ArgumentNullException("modelState");
}
KeyBuilders = new Stack<IBodyModelValidatorKeyBuilder>();
ModelState = modelState;
Visited = new HashSet<object>(ReferenceEqualityComparer.Instance);
}
/// <summary>
/// Gets or sets the <see cref="ModelMetadataProvider"/> used to provide the model metadata.
/// </summary>
public ModelMetadataProvider MetadataProvider { get; set; }
/// <summary>
/// Gets or sets the <see cref="HttpActionContext"/> within which the model is being validated.
/// </summary>
public HttpActionContext ActionContext { get; set; }
/// <summary>
/// Gets or sets the <see cref="IModelValidatorCache"/>.
/// </summary>
public IModelValidatorCache ValidatorCache { get; set; }
/// <summary>
/// Gets the current <see cref="ModelStateDictionary"/>.
/// </summary>
public ModelStateDictionary ModelState { get; private set; }
/// <summary>
/// Gets the set of model objects visited in this validation. Includes the model being validated in the
/// current scope.
/// </summary>
public HashSet<object> Visited { get; private set; }
/// <summary>
/// Gets the stack of <see cref="IBodyModelValidatorKeyBuilder"/>s used in this validation. Includes
/// the <see cref="IBodyModelValidatorKeyBuilder"/> to generate model state keys for the current scope.
/// </summary>
public Stack<IBodyModelValidatorKeyBuilder> KeyBuilders { get; private set; }
/// <summary>
/// Gets or sets the model state prefix for the root scope of this validation.
/// </summary>
public string RootPrefix { get; set; }
}
}