CompareAttribute 類別

定義

警告

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

提供其會比較模型兩個屬性 (Property) 的屬性 (Attribute)。

[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)
已淘汰.

判斷指定的物件是否等於被比較的物件。

適用於