System.ComponentModel.DataAnnotations Namespace
The System.ComponentModel.DataAnnotations namespace provides attribute classes that are used to define metadata for ASP.NET MVC and Dynamic Data controls.
| Class | Description | |
|---|---|---|
|
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. |
|
ConcurrencyCheckAttribute | Specifies that a property participates in optimistic concurrency checks. |
|
CustomValidationAttribute | Specifies a custom validation method to 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 | Specifies how data fields are displayed and formatted by ASP.NET Dynamic Data. |
|
EditableAttribute | Indicates whether a data field is editable. |
|
EnumDataTypeAttribute | Enables a .NET Framework enumeration to be mapped to a data column. |
|
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. |
|
MetadataTypeAttribute | Specifies the metadata class to associate with a data model class. |
|
RangeAttribute | Specifies the numeric range constraints for the value of a data field. |
|
RegularExpressionAttribute | 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. |
|
ValidationAttribute | Serves as the base class for all validation attributes. |
|
ValidationContext | Describes the context in which a validation check is performed. |
|
ValidationException | 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 | Defines a helper class that can be used to validate objects, properties, and methods when it is included in their associated ValidationAttribute attributes. |
| Interface | Description | |
|---|---|---|
|
IValidatableObject | Provides a way for an object to be invalidated. |
| Enumeration | Description | |
|---|---|---|
|
DataType | Represents an enumeration of the data types associated with data fields and parameters. |
The description sounds like this namespace is only useful for ASP.NET applications. But that’s not true. This namespace contains attributes to define validation rules and display strategies for dynamic user interfaces (e.g. Dynamic Data controls).
This namespace contains also a small validation framework which can be used via the Validator class. The DataAnnotations namespace is useful for other application types as well.
Example: The sample applications of the WPF Application Framework (WAF) show how this validation framework can be used in WPF applications. See: http://waf.codeplex.com.
- 9/30/2011
- jbe2277