System.ComponentModel.DataAnnotations Namespace

System.ComponentModel.DataAnnotations 命名空间提供定义 ASP.NET MVC 和 ASP.NET 数据控件的类的特性。 The System.ComponentModel.DataAnnotations namespace provides attribute classes that are used to define metadata for ASP.NET MVC and ASP.NET data controls.

Classes

AssociatedMetadataTypeTypeDescriptionProvider

通过添加在关联类中定义的特性和属性信息,从而扩展某个类的元数据信息。Extends the metadata information for a class by adding attributes and property information that is defined in an associated class.

AssociationAttribute

指定实体成员表示数据关系(如外键关系)。Specifies that an entity member represents a data relationship, such as a foreign key relationship.

BindableTypeAttribute

指定类型是否通常用于绑定。Specifies whether a type is typically used for binding.

CompareAttribute

提供用于比较两个属性的特性。Provides an attribute that compares two properties.

ConcurrencyCheckAttribute

指定属性参与乐观并发检查。Specifies that a property participates in optimistic concurrency checks.

CreditCardAttribute

指定数据字段值是信用卡号。Specifies that a data field value is a credit card number.

CustomValidationAttribute

指定用于验证属性或类实例的自定义验证方法。Specifies a custom validation method that is used to validate a property or class instance.

DataTypeAttribute

指定要与数据字段关联的其他类型的名称。Specifies the name of an additional type to associate with a data field.

DisplayAttribute

提供允许为实体分部类的类型和成员指定可本地化字符串的通用特性。Provides a general-purpose attribute that lets you specify localizable strings for types and members of entity partial classes.

DisplayColumnAttribute

指定作为外键列显示在被引用表中的列。Specifies the column that is displayed in the referred table as a foreign-key column.

DisplayFormatAttribute

指定 ASP.NET 动态数据如何显示数据字段以及如何设置数据字段的格式。Specifies how data fields are displayed and formatted by ASP.NET Dynamic Data.

EditableAttribute

指示数据字段是否可编辑。Indicates whether a data field is editable.

EmailAddressAttribute

验证电子邮件地址。Validates an email address.

EnumDataTypeAttribute

启用 .NET Framework 枚举,以映射到数据列。Enables a .NET Framework enumeration to be mapped to a data column.

FileExtensionsAttribute

验证文件扩展名。Validates file name extensions.

FilterUIHintAttribute

表示用于指定列的筛选行为的特性。Represents an attribute that is used to specify the filtering behavior for a column.

KeyAttribute

表示一个或多个用于唯一标识实体的属性。Denotes one or more properties that uniquely identify an entity.

MaxLengthAttribute

指定属性中允许的数组或字符串数据的最大长度。Specifies the maximum length of array or string data allowed in a property.

MetadataTypeAttribute

指定要与数据模型类关联的元数据类。Specifies the metadata class to associate with a data model class.

MinLengthAttribute

指定属性中允许的数组或字符串数据的最小长度。Specifies the minimum length of array or string data allowed in a property.

PhoneAttribute

指定数据字段值是格式标准的电话号码。Specifies that a data field value is a well-formed phone number.

RangeAttribute

为数据字段的值指定数值范围约束。Specifies the numeric range constraints for the value of a data field.

RegularExpressionAttribute

指定 ASP.NET 动态数据中的数据字段值必须与指定的正则表达式匹配。Specifies that a data field value in ASP.NET Dynamic Data must match the specified regular expression.

RequiredAttribute

指定数据字段值是必需的。Specifies that a data field value is required.

ScaffoldColumnAttribute

指定类或数据列是否使用基架。Specifies whether a class or data column uses scaffolding.

ScaffoldTableAttribute

指定类或数据表是否使用基架。Specifies whether a class or data table uses scaffolding.

StringLengthAttribute

指定数据字段中允许的字符的最小长度和最大长度。Specifies the minimum and maximum length of characters that are allowed in a data field.

TimestampAttribute

列的数据类型指定为行版本。Specifies the data type of the column as a row version.

UIHintAttribute

指定动态数据用来显示数据字段的模板或用户控件。Specifies the template or user control that Dynamic Data uses to display a data field.

UrlAttribute

提供 URL 验证。Provides URL validation.

ValidationAttribute

充当所有验证特性的基类。Serves as the base class for all validation attributes.

ValidationContext

描述执行验证检查的上下文。Describes the context in which a validation check is performed.

ValidationException

表示在使用 ValidationAttribute 类的情况下验证数据字段时发生的异常。Represents the exception that occurs during validation of a data field when the ValidationAttribute class is used.

ValidationResult

表示验证请求结果的容器。Represents a container for the results of a validation request.

Validator

定义一个帮助器类,在与对象、属性和方法关联的 ValidationAttribute 特性中包含此类时,可使用此类来验证这些项。Defines a helper class that can be used to validate objects, properties, and methods when it is included in their associated ValidationAttribute attributes.

Interfaces

IValidatableObject

提供用于使对象无效的方式。Provides a way for an object to be invalidated.

Enums

DataType

表示与数据字段和参数关联的数据类型的枚举。Represents an enumeration of the data types associated with data fields and parameters.