CompareAttribute クラス

定義

注意事項

The recommended alternative is to use the System.ComponentModel.DataAnnotations.CompareAttribute type, which has the same functionality as this type.

モデルの 2 つのプロパティを比較する属性を提供します。

[System.AttributeUsage(System.AttributeTargets.Property)]
[System.Obsolete("The recommended alternative is to use the System.ComponentModel.DataAnnotations.CompareAttribute type, which has the same functionality as this type.")]
public class CompareAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute, System.Web.Mvc.IClientValidatable
type CompareAttribute = class
    inherit ValidationAttribute
    interface IClientValidatable
Public Class CompareAttribute
Inherits ValidationAttribute
Implements IClientValidatable
継承
CompareAttribute
属性
実装

コンストラクター

CompareAttribute(String)
古い.

CompareAttribute クラスの新しいインスタンスを初期化します。

プロパティ

OtherProperty
古い.

現在のプロパティと比較するプロパティを取得します。

OtherPropertyDisplayName
古い.

他のプロパティの表示名を取得します。

メソッド

FormatErrorMessage(String)
古い.

比較エラーが発生したデータ フィールドに基づいてエラー メッセージに書式を適用します。

FormatPropertyForClientValidation(String)
古い.

アスタリスク (*) およびドットを前に付けることによって、クライアント検証のプロパティの書式を設定します。

GetClientValidationRules(ModelMetadata, ControllerContext)
古い.

指定したモデル メタデータとコントローラー コンテキストを使用して、プロパティの比較値のクライアント検証規則のリストを取得します。

IsValid(Object, ValidationContext)
古い.

指定のオブジェクトが、比較対象のオブジェクトと等しいかどうかを判断します。

適用対象