Solution: If you intend to create a table without a primary key in the database just add [Keyless] before class name as follows: [Keyless] public class DisplayDetails { } You might come across the error when you add "keyless" that is because you also need to add this using statement: using Microsoft.EntityFrameworkCore;
The migration ‘20220222164040_CreateUserTable’ has already been applied to the database. Revert it and try again. If the migration has been applied to other databases, consider reverting its changes using a new migration instead.
The solution is simple. Just force to remove the migration by typing this command in the package manager console and the migration will be removed: Remove-Migration -Force