ArvidsonFoto MVC NET8
1.0.0
使用MVC和.NET8重建ArvidsonFoto(从.NET5升级到.NET6再到.NET8)
要启动该网站,您需要完成几个步骤。
modelBuilder.InitialDatabaseSeed();
(大约第 163 行)位于/ArvidsonFoto/Data/ArvidsonFotoDbContext.cs中,以便能够使用关联数据创建新数据库。dotnet ef database update --context ArvidsonFotoDbContext
dotnet ef database update --context ArvidsonFotoIdentityContext
要在数据模型更改时创建新迁移,请运行以下命令: dotnet-ef migrations add DatabaseSeed --context ArvidsonFotoDbContext
如果您在运行dotnet-ef database update
时收到错误消息,其中显示:
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a build-in dotnet command.
* You intended to execute a .NET program , but dotnet-ef does not exist.
* You intended to run a global tool, but dotnet-prefixed executable with this name could not be found on the PATH.
然后需要安装dotnet-ef CLI(dotnet实体框架),通过命令安装:
dotnet tool install --global dotnet-ef
使用以下命令将 dotnet-ef 更新到版本 8.0.0 或更高版本:
dotnet tool update --global dotnet-ef