I am trying to learn the architecture but cannot understand why Context does not have DbSet<> tables. For example:
public DbSet <Department> Departments {get;set;}
public DbSet <User> Users {get;set;}
When running migrations, tables are not creating in the database.
Even adding them to DbContext this error shows up:
The entity type 'BaseDomainEvent' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.
Even ignoring DbSet<> running the API project when hitting Users shows this error:
System.InvalidOperationException: Cannot create a DbSet for 'User' because this type is not included in the model for the context.
I did a migration in VSCode.
dotnet ef migrations add initialcreation1 -s ../API/API.csproj
dotnet ef database update -s ../API/API.csproj
I am trying to learn the architecture but cannot understand why Context does not have DbSet<> tables. For example:
When running migrations, tables are not creating in the database.
Even adding them to DbContext this error shows up:
Even ignoring DbSet<> running the API project when hitting Users shows this error:
I did a migration in VSCode.