2 writes to ErrorMessage
System.ComponentModel.Annotations (2)
System\ComponentModel\DataAnnotations\ValidationResult.cs (2)
59ErrorMessage = errorMessage; 72ErrorMessage = validationResult.ErrorMessage;
45 references to ErrorMessage
Microsoft.AspNetCore.Components.Forms (3)
EditContextDataAnnotationsExtensions.cs (3)
100_messages.Add(fieldIdentifier, result.ErrorMessage!); 129_messages.Add(_editContext.Field(memberName), validationResult.ErrorMessage!); 134_messages.Add(new FieldIdentifier(_editContext.Model, fieldName: string.Empty), validationResult.ErrorMessage!);
Microsoft.AspNetCore.Mvc.DataAnnotations (4)
DataAnnotationsModelValidator.cs (2)
92errorMessage = GetErrorMessage(validationContext) ?? result.ErrorMessage; 96errorMessage = result.ErrorMessage;
ValidatableObjectAdapter.cs (2)
53yield return new ModelValidationResult(memberName: null, message: result.ErrorMessage); 59yield return new ModelValidationResult(memberName, result.ErrorMessage);
Microsoft.Extensions.Options (3)
ValidateOptionsResultBuilder.cs (3)
44if (result?.ErrorMessage is not null) 48? $"{joinedMembers}: {result.ErrorMessage}" 49: result.ErrorMessage);
Microsoft.Extensions.Options.DataAnnotations (1)
DataAnnotationValidateOptions.cs (1)
92errors.Add($"DataAnnotation validation failed for '{qualifiedName}' members: '{string.Join(",", result.MemberNames)}' with the error: '{result.ErrorMessage}'.");
Shared.Tests (24)
Data.Validation\LengthAttributeTests.cs (14)
42Assert.Contains(nameof(options.Name), results[0].ErrorMessage); 56Assert.Contains(nameof(options.Address), results[0].ErrorMessage); 63Assert.Contains(nameof(options.Address), results[0].ErrorMessage); 98Assert.Contains(nameof(options.Name), results[0].ErrorMessage); 112Assert.Contains(nameof(options.Address), results[0].ErrorMessage); 120Assert.Contains(nameof(options.Address), results[0].ErrorMessage); 171Assert.Contains(nameof(options.Names), results[0].ErrorMessage); 189Assert.Contains(nameof(options.Addresses), results[0].ErrorMessage); 225Assert.Contains(nameof(options.Names), results[0].ErrorMessage); 237Assert.Contains(nameof(options.Addresses), results[0].ErrorMessage); 278Assert.Contains(nameof(options.Names), results[0].ErrorMessage); 296Assert.Contains(nameof(options.Addresses), results[0].ErrorMessage); 396Assert.Equal("My custom message for 'CustomMessage'.", results.Single().ErrorMessage); 416Assert.Equal("The field DefaultMessage length must be greater or equal than 5.", results.Single().ErrorMessage);
Data.Validation\TimeSpanAttributeTests.cs (10)
40Assert.Contains(nameof(options.Time), results[0].ErrorMessage); 47Assert.Contains(nameof(options.Time), results[0].ErrorMessage); 65Assert.Contains(nameof(options.Time2), results[0].ErrorMessage); 105Assert.Contains(nameof(options.Time), results[0].ErrorMessage); 112Assert.Contains(nameof(options.Time), results[0].ErrorMessage); 126Assert.Contains(nameof(options.Time2), results[0].ErrorMessage); 133Assert.Contains(nameof(options.Time2), results[0].ErrorMessage); 168Assert.Contains(nameof(options.Time), results[0].ErrorMessage); 175Assert.Contains(nameof(options.Time), results[0].ErrorMessage); 193Assert.Contains(nameof(options.Time2), results[0].ErrorMessage);
System.ComponentModel.Annotations (10)
System\ComponentModel\DataAnnotations\CustomValidationAttribute.cs (2)
50/// <see cref="ValidationResult.ErrorMessage" /> 176_lastMessage = result.ErrorMessage;
System\ComponentModel\DataAnnotations\ValidationAttribute.cs (2)
411/// <see cref="ValidationResult.ErrorMessage" />. 439if (string.IsNullOrEmpty(result.ErrorMessage))
System\ComponentModel\DataAnnotations\ValidationException.cs (1)
26: this(validationResult.ErrorMessage, validatingAttribute, value)
System\ComponentModel\DataAnnotations\ValidationResult.cs (5)
72ErrorMessage = validationResult.ErrorMessage; 96/// the <see cref="ErrorMessage" /> if not <c>null</c>, otherwise 100/// If the <see cref="ErrorMessage" /> is empty, it will still qualify 104/// The <see cref="ErrorMessage" /> property value if specified, 107public override string ToString() => ErrorMessage ?? base.ToString()!;