Data Annotation Attributes in Entity Framework Core | Day 5 | Entity Framework Core Tutorials
Data Annotation Attributes in Entity Framework Core | Day 5 | Entity Framework Core Tutorials Default Conventions in EF Core Entity Framework Core (EF Core) uses a set of default conventions that determines how to map between our database and entity classes. These conventions help us reduce the configuration code to achieve this mapping. Data Annotation Attributes in Entity Framework Core Data Annotations are nothing but Attributes or Classes that can be applied to our domain classes and their properties to override the default conventions that Entity Framework Core follows. The Data Annotations Attributes are included in separate namespaces called System.ComponentModel.DataAnnotations and System.ComponentModel.DataAnnotations.Schema. Table Data Annotation Attribute in Entity Framework Core The Table Data Annotation Attribute in Entity Framework Core can be applied to a domain class to configure the corresponding database table name and schema. It overrides the default convention in Entity Framework Core. As per the default conventions, Entity Framework Core will create a database table whose name is the same as the DbSet Property name. Column Data Annotation Attribute in Entity Framework Core: The Column Data Annotation Attribute can be applied to one or more properties of a domain entity to configure the corresponding database column name, column order, and column data type. That means it represents the database column that a property is mapped to. In Entity Framework Core (EF Core), the [Column] attribute allows developers to provide additional configuration related to how an entity class property maps to a database column. With the [Column] attribute, you can specify things like the name of the database column, its order, and its data type. Text Document Links: Default Conventions in Entity Framework Core: https://dotnettutorials.net/lesson/default-conventions-in-entity-framework-core/