小编LJF*_*ney的帖子

How do I specify a schema for IdentityServer4 Entity Framework Core Migrations?

I am using IdentityServer4 2.0.2, and have followed the QuickStart tutorial to use Entity Framework Core. I am trying to change from the default schema (dbo) to a custom schema in SQL Server. The following code is working correctly, instructing the DbContexts to look for the tables in the "idsrv4" schema.

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();

    var identityConnectionString = Configuration.GetConnectionString("Identity");
    var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;

    services.AddIdentityServer()
        .AddDeveloperSigningCredential()
        .AddTestUsers(Config.GetUsers())
        .AddConfigurationStore(options =>
        {
            options.DefaultSchema = "idsrv4";
            options.ConfigureDbContext = builder => builder.UseSqlServer(identityConnectionString,
                sql …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core identityserver4 ef-core-2.0

5
推荐指数
1
解决办法
2957
查看次数

标签 统计

asp.net-core ×1

c# ×1

ef-core-2.0 ×1

identityserver4 ×1