In Visual Studio, use the Package Manager Console to scaffold a new migration
for these changes and apply them to the database:
PM> Add-Migration [migration name]
PM> Update-DatabaseAlternatively, you can scaffold a new migration and
apply it from a command prompt at your project directory:
> dotnet ef migrations add [migration name]
> dotnet ef database update
primary key
By default, the Entity Framework interprets a property that’s named ID or classnameID as the primary key. 如果是composition key, ef for asp.net core只能通过fluent api来实现:
近期评论