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