Defining the data layer
The data layer project contains references to the Microsoft.AspNetCore.Identity.EntityFrameworkCore
and Microsoft.EntityFrameworkCore.SqlServer
NuGet packages, since we are using Entity Framework Core with SQL Server. It references Microsoft.EntityFrameworkCore.Tools
and Microsoft.EntityFrameworkCore.Design
, which are needed to generate database migrations, as explained in the Entity Framework Core migrations section of Chapter 7, Interacting with Data in C# – Entity Framework Core.
We have a Models
folder that contains all database entities. They are similar to the ones in Chapter 7, Interacting with Data in C# – Entity Framework Core. The only differences are as follows:
- They inherit from
Entity<T>
, which contains all basic features of aggregates. Please note that inheriting fromEntity<T>
is only needed for aggregate roots; all other entities must be defined as explained in Chapter 7, Interacting with Data in C# ...