System.ComponentModel.DataAnnotations 命名空間

提供屬性類別,這些類別可用來定義 ASP.NET MVC 和 ASP.NET 資料控制項的中繼資料。 Provides attribute classes that are used to define metadata for ASP.NET MVC and ASP.NET data controls.

類別

AssociatedMetadataTypeTypeDescriptionProvider

會以加入於關聯類別中定義之屬性 (Attribute) 及屬性 (Property) 資訊的方式,延伸類別中繼資料的資訊。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

提供比較兩個屬性 (Property) 的屬性 (Attribute)。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 Dynamic Data 顯示和格式化資料欄位的方式。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 列舉對應至資料行。Enables a .NET 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 Dynamic Data 中的資料欄位值必須符合指定的規則運算式 (Regular Expression)。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

指定類別或資料行是否使用 Scaffolding。Specifies whether a class or data column uses scaffolding.

ScaffoldTableAttribute

指定類別或資料的資料表 (Data Table) 是否使用 Scaffolding。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

指定 Dynamic Data 用來顯示資料欄位的範本或使用者控制項。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 類別驗證資料欄位時發生的例外狀況 (Exception)。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

定義 Helper 類別,包含在相關聯的 ValidationAttribute 屬性內時,可用來驗證物件、屬性和方法。Defines a helper class that can be used to validate objects, properties, and methods when it is included in their associated ValidationAttribute attributes.

介面

IValidatableObject

提供物件的驗證方式。Provides a way for an object to be validated.

列舉

DataType

代表與資料欄位和參數關聯的資料類型列舉。Represents an enumeration of the data types associated with data fields and parameters.