The HasAlternateKey method creates the Unique constraint for the property in the database. The Primary Key already has Unique Constraint defined, but you can have only one Primary Key in the table. Unique Constraints ensures that no duplicate values are entered in the columns.
The Ignore method of the EF Core Fluent API is used to Ignore a Property or Entity from being mapped to the database
The Entity Framework Core Fluent API is used to configure the model classes. In this tutorial, we will learn the basics of Fluent API and learn how to use it to configure the model. The database is built using the model, which is known as Code First, The EF Core calculates the model by using the conventions and data annotation attributes. Both conventions and annotations do not cover all the functionalities. The Fluent API is another way to configure our domain classes. It is more flexible and provides developers with more power to configure the database.
EF Core Conventions or the default rules that you follow while creating the entity model. The EF Core uses these to infer and to configure the Database. It uses the information available in the POCO Classes to determine and infer the schema of the database that these classes are mapped to. For example, the table name, Column Name, Data Type, Primary keys are inferred from the Class name, property name & Property type by convention to build the database
In this article, we will learn how to use Entity Framework core with existing database or Database First approach. The Entity Framework only supports code first & Database first approach. In Database First, we use scaffolding to create the entities from the existing database. This process is also called as the Reverse engineer the existing database. Once the entity classes are created both databases first & code first approach works in the same way Database First Approach