DataAnnotations

System.ComponentModel.DataAnnotations.Schema attributes

Attribute Description
Table The database table and/or schema that a class is mapped to.
Column The database column that a property is mapped to.
ForeignKey Specifies the property is used as a foreign key in a relationship.
DatabaseGenerated Specifies how the database generates values for a property.
NotMapped Applied to properties or classes that are to be excluded from database mapping.
InverseProperty Specifies the inverse of a navigation property
ComplexType Denotes that the class is a complex type. *Not currently implemented in EF Core.

System.ComponentModel.Annotations attributes

Attribute Description
Key Identifies one or more properties as a Key
Timestamp Specifies the data type of the database column as rowversion
ConcurrencyCheck Specifies that the property is included in concurrency checks
Required Specifies that the property’s value is required
MaxLength Sets the maximum allowed length of the property value (string or array)
StringLength Sets the maximum allowed length of the property value (string or array)

Algunos enlaces:

Validando sin parar. Uso de DataAnnotations

https://www.learnentityframeworkcore.com/configuration/data-annotation-attributes

https://www.c-sharpcorner.com/article/model-validation-using-data-annotations-in-asp-net-mvc/

Publicado por

Avatar del usuario

Juan Pablo Fuentes

Formador de programación y bases de datos