This project uses Microsoft Entity Framework (EF) Core, which supports two primary approaches for working with databases: Code/Database-First.
EF Core Code-First Approach
This approach defines your database schema using C# model classes of MVC.
For example,
public class Product {
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; } }
The database is generated based on these classes by entering the following two commands in :
and
.
It is ideal when starting a new project where the database does not yet exist.
EF Core Database-First Approach
This approach starts with an existing database, and EF Core generates the data model (classes) based on the database schema.
Use the or command to generate models.
For example,