CompareAttribute 类

定义

注意

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

提供用于比较某个模型的两个属性的特性。

[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)
已过时.

确定指定对象是否等于比较对象。

适用于