CompareAttribute 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
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) |
已过时.
确定指定对象是否等于比较对象。 |
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈