共用方式為


System.ComponentModel.DataAnnotations Namespace

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides attribute classes that are used to define metadata for entity classes.

Classes

  Class Description
Public class AssociationAttribute Specifies that an entity member represents a data relationship, such as a foreign key relationship.
Public class ConcurrencyCheckAttribute Designates that a property participates in optimistic concurrency checks.
Public class CustomValidationAttribute Designates a customized method to execute to validate the entity member.
Public class DataTypeAttribute Specifies the name of an additional type to associate with an entity member.
Public class DisplayAttribute Specifies localizable strings for entity types and members that are used in the user interface.
Public class DisplayColumnAttribute Designates the property to display, the property to use for sorting, and the sort order when a table is used as a parent table in a foreign key relationship.
Public class DisplayFormatAttribute Specifies how data fields are displayed and formatted.
Public class EditableAttribute Specifies whether users should be able to change the value of the entity property.
Public class EnumDataTypeAttribute Specifies that an entity member corresponds to an enumeration type.
Public class FilterUIHintAttribute Designates the filtering behavior for a column.
Public class KeyAttribute Specifies one or more entity properties to use as the unique identity for the entity.
Public class RangeAttribute Designates the minimum and maximum constraints for the associated member.
Public class RegularExpressionAttribute Designates a regular expression to use for validation of the associated member.
Public class RequiredAttribute Specifies that a value must be provided for a property.
Public class StringLengthAttribute Specifies the maximum and minimum number of characters that are allowed for an entity member.
Public class TimestampAttribute Designates a member as a time stamp value.
Public class UIHintAttribute Designates the control and values to use to display the associated entity member.
Public class ValidationAttribute Serves as the base class for all validation attributes.
Public class ValidationContext Provides information about a type or member to validate.
Public class ValidationException Represents the exception that occurred during validation of a member that is marked with a validation attribute.
Public class ValidationResult Contains the results of a validation request.
Public class Validator Provides members to help validate objects and members using values from the associated ValidationAttribute attribute.

Enumerations

  Enumeration Description
Public enumeration DataType Represents data types that are associated with data properties.