3 instantiations of ValidationContext
System.ComponentModel.DataAnnotations (1)
DataAnnotations\Validator.cs (1)
284
ValidationContext context = new
ValidationContext
(instance, validationContext, validationContext.Items);
System.Web (2)
ModelBinding\DataAnnotationsModelValidator.cs (1)
74
ValidationContext context = new
ValidationContext
(container ?? Metadata.Model, null, null);
ModelBinding\ValidatableObjectAdapter.cs (1)
34
ValidationContext validationContext = new
ValidationContext
(validatable, null, null);
89 references to ValidationContext
System.ComponentModel.DataAnnotations (85)
DataAnnotations\CompareAttribute.cs (1)
38
protected override ValidationResult IsValid(object value,
ValidationContext
validationContext) {
DataAnnotations\CustomValidationAttribute.cs (9)
12
/// public static <see cref="ValidationResult"/> Method(object value, <see cref="
ValidationContext
"/> context) { ... }
20
/// Like any other <see cref="ValidationAttribute"/>, its <see cref="IsValid(object,
ValidationContext
)"/>
32
/// The <see cref="Method"/> may also declare an additional parameter of type <see cref="
ValidationContext
"/>.
33
/// The <see cref="
ValidationContext
"/> parameter provides additional context the method may use to determine
70
/// <see cref="IsValid(object,
ValidationContext
)"/>> to return a <see cref="ValidationResult"/>
120
/// Override of validation method. See <see cref="ValidationAttribute.IsValid(object,
ValidationContext
)"/>.
123
/// <param name="validationContext">A <see cref="
ValidationContext
"/> instance that provides
127
protected override ValidationResult IsValid(object value,
ValidationContext
validationContext) {
247
if ((parameterInfos.Length != 2) || (parameterInfos[1].ParameterType != typeof(
ValidationContext
))) {
DataAnnotations\IValidatableObject.cs (1)
8
IEnumerable<ValidationResult> Validate(
ValidationContext
validationContext);
DataAnnotations\ValidationAttribute.cs (23)
10
/// <para>Override <see cref="IsValid(object,
ValidationContext
)"/> to implement validation logic.</para>
112
/// A flag indicating that the attribute requires a non-null <see cref=System.ComponentModel.DataAnnotations.
ValidationContext
/>
to
perform
validation
.
113
///
Base
class
returns
false.
Override
in
child
classes
as
appropriate
.
306
/// Instead, implement <see cref="IsValid(object,
ValidationContext
)"/>.
341
/// <param name="validationContext">A <see cref="
ValidationContext
"/> instance that provides
350
/// <exception cref="NotImplementedException"> is thrown when <see cref="IsValid(object,
ValidationContext
)" />
371
protected virtual ValidationResult IsValid(object value,
ValidationContext
validationContext) {
398
/// <param name="validationContext">A <see cref="
ValidationContext
"/> instance that provides
408
/// <exception cref="NotImplementedException"> is thrown when <see cref="IsValid(object,
ValidationContext
)" />
411
public ValidationResult GetValidationResult(object value,
ValidationContext
validationContext) {
434
/// The overloaded <see cref="Validate(object,
ValidationContext
)"/> is the recommended entry point as it
458
/// <remarks>This method invokes the <see cref="IsValid(object,
ValidationContext
)"/> method
465
/// <exception cref="ValidationException"> is thrown if <see cref="IsValid(object,
ValidationContext
)"/>
469
/// <exception cref="NotImplementedException"> is thrown when <see cref="IsValid(object,
ValidationContext
)" />
472
public void Validate(object value,
ValidationContext
validationContext) {
DataAnnotations\ValidationAttributeStore.cs (11)
35
internal IEnumerable<ValidationAttribute> GetTypeValidationAttributes(
ValidationContext
validationContext) {
46
internal DisplayAttribute GetTypeDisplayAttribute(
ValidationContext
validationContext) {
57
internal IEnumerable<ValidationAttribute> GetPropertyValidationAttributes(
ValidationContext
validationContext) {
69
internal DisplayAttribute GetPropertyDisplayAttribute(
ValidationContext
validationContext) {
81
internal Type GetPropertyType(
ValidationContext
validationContext) {
89
/// Determines whether or not a given <see cref="
ValidationContext
"/>'s
90
/// <see cref="
ValidationContext
.MemberName"/> references a property on
91
/// the <see cref="
ValidationContext
.ObjectType"/>.
93
/// <param name="validationContext">The <see cref="
ValidationContext
"/> to check.</param>
95
internal bool IsPropertyContext(
ValidationContext
validationContext) {
134
private static void EnsureValidationContext(
ValidationContext
validationContext) {
DataAnnotations\ValidationContext.cs (7)
23
/// will be available to validation methods that use this <see cref="
ValidationContext
"/>
42
/// Construct a <see cref="
ValidationContext
"/> for a given object instance being validated.
51
/// Construct a <see cref="
ValidationContext
"/> for a given object instance and an optional
81
/// Construct a <see cref="
ValidationContext
"/> for a given object instance, an optional <paramref name="serviceProvider"/>, and an optional
242
/// Initializes the <see cref="
ValidationContext
"/> with a service provider that can return
270
/// <see cref="IServiceProvider"/> provided to this <see cref="
ValidationContext
"/>
322
/// as a default service container on <see cref="
ValidationContext
"/>.
DataAnnotations\Validator.cs (33)
38
/// When the <see cref="
ValidationContext
.MemberName"/> of <paramref name="validationContext"/> is not a valid property.
40
public static bool TryValidateProperty(object value,
ValidationContext
validationContext, ICollection<ValidationResult> validationResults) {
81
/// <see cref="
ValidationContext
.ObjectInstance"/>on <paramref name="validationContext"/>.</exception>
82
public static bool TryValidateObject(object instance,
ValidationContext
validationContext, ICollection<ValidationResult> validationResults) {
112
/// <see cref="
ValidationContext
.ObjectInstance"/>on <paramref name="validationContext"/>.</exception>
113
public static bool TryValidateObject(object instance,
ValidationContext
validationContext, ICollection<ValidationResult> validationResults, bool validateAllProperties) {
159
public static bool TryValidateValue(object value,
ValidationContext
validationContext, ICollection<ValidationResult> validationResults, IEnumerable<ValidationAttribute> validationAttributes) {
181
public static void ValidateProperty(object value,
ValidationContext
validationContext) {
205
/// <see cref="
ValidationContext
.ObjectInstance"/> on <paramref name="validationContext"/>.</exception>
207
public static void ValidateObject(object instance,
ValidationContext
validationContext) {
224
/// <see cref="
ValidationContext
.ObjectInstance"/> on <paramref name="validationContext"/>.</exception>
226
public static void ValidateObject(object instance,
ValidationContext
validationContext, bool validateAllProperties) {
258
public static void ValidateValue(object value,
ValidationContext
validationContext, IEnumerable<ValidationAttribute> validationAttributes) {
270
/// Creates a new <see cref="
ValidationContext
"/> to use to validate the type or a member of
275
/// and <see cref="
ValidationContext
.Items"/>.</param>
276
/// <returns>A new <see cref="
ValidationContext
"/> for the <paramref name="instance"/> provided.</returns>
278
internal static
ValidationContext
CreateValidationContext(object instance,
ValidationContext
validationContext) {
284
ValidationContext
context = new ValidationContext(instance, validationContext, validationContext.Items);
335
/// <see cref="
ValidationContext
.ObjectInstance"/> on <paramref name="validationContext"/>.</exception>
336
private static IEnumerable<ValidationError> GetObjectValidationErrors(object instance,
ValidationContext
validationContext, bool validateAllProperties, bool breakOnFirstError) {
387
private static IEnumerable<ValidationError> GetObjectPropertyValidationErrors(object instance,
ValidationContext
validationContext, bool validateAllProperties, bool breakOnFirstError) {
388
ICollection<KeyValuePair<
ValidationContext
, object>> properties = GetPropertyValues(instance, validationContext);
391
foreach (KeyValuePair<
ValidationContext
, object> property in properties) {
427
private static ICollection<KeyValuePair<
ValidationContext
, object>> GetPropertyValues(object instance,
ValidationContext
validationContext) {
444
List<KeyValuePair<
ValidationContext
, object>> items = new List<KeyValuePair<
ValidationContext
, object>>(properties.Count);
446
ValidationContext
context = CreateValidationContext(instance, validationContext);
450
items.Add(new KeyValuePair<
ValidationContext
, object>(context, property.GetValue(instance)));
472
private static IEnumerable<ValidationError> GetValidationErrors(object value,
ValidationContext
validationContext, IEnumerable<ValidationAttribute> attributes, bool breakOnFirstError) {
506
/// Tests whether a value is valid against a single <see cref="ValidationAttribute"/> using the <see cref="
ValidationContext
"/>.
514
private static bool TryValidate(object value,
ValidationContext
validationContext, ValidationAttribute attribute, out ValidationError validationError) {
System.Web (4)
ModelBinding\DataAnnotationsModelValidator.cs (1)
74
ValidationContext
context = new ValidationContext(container ?? Metadata.Model, null, null);
ModelBinding\ValidatableObjectAdapter.cs (1)
34
ValidationContext
validationContext = new ValidationContext(validatable, null, null);
Security\MembershipPasswordAttribute.cs (2)
161
/// <param name="validationContext">A <see cref="
ValidationContext
"/> instance that provides
169
protected override ValidationResult IsValid(object value,
ValidationContext
validationContext) {