ValidationContext.MemberName ValidationContext.MemberName ValidationContext.MemberName ValidationContext.MemberName Property

Definition

Gets or sets the name of the member to validate.

public:
 property System::String ^ MemberName { System::String ^ get(); void set(System::String ^ value); };
public string MemberName { get; set; }
member this.MemberName : string with get, set
Public Property MemberName As String

Property Value

The name of the member to validate.

Remarks

This property represents an entity member name, not the name of a corresponding data field. Therefore, this name is not a localized name. It should be set only for property or parameter contexts.

In .NET Framework 4.7.2 and earlier versions, when using a custom System.ComponentModel.DataAnnotations.ValidationAttribute, the MemberName property returns null. Starting with .NET Framework 4.8, you can change the default behavior so that the property returns the member name by adding the following setting to your app config file:

<configuration>
   <appSettings>
      <add key="aspnet:GetValidationMemberName" value="true" />
   </appSettings>
</configuration>

Applies to