gpt4 book ai didi

c# - 如何为 SQLite 创建身份服务器数据库?

转载 作者:行者123 更新时间:2023-12-05 06:25:24 25 4
gpt4 key购买 nike

我已经运行 dotnet new is4ef 来创建一个 Identity Server 模板。

接下来,我在 Startup.cs 中更改了 UseSqlServer() -> UseSqlite()

程序可以编译,但运行时不会创建数据库中的表。

如何为配置存储和运营存储创建合适的表?

最佳答案

要创建数据库,您需要运行迁移:

dotnet tool install --global dotnet-ef
dotnet ef migrations add 'initial' --project src/IdentityServer/IdentityServer.csproj --context PersistedGrantDbContext

然后你更新数据库

dotnet ef database update --project src/IdentityServer/IdentityServer.csproj --context ConfigurationDbContext

然后创建数据库。

关于c# - 如何为 SQLite 创建身份服务器数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57124821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com