private static async Task EnsureSeedIDS4DataAsync(IDS4DbContext context, IServiceProvider sp)
        {
            var configuraion = sp.GetRequiredService <IConfiguration>();

            var endpoints = new Dictionary <string, string> {
                { "ids4adminui", configuraion.GetValue <string>("IDS4AdminUIEndpoint") },
                { "ids4adminapi", configuraion.GetValue <string>("IDS4AdminAPIEndpoint") },
            };

            if (!context.Clients.Any())
            {
                foreach (var client in Configuration.GetClients(endpoints))
                {
                    var entity = client.ToEntity();
                    await context.Clients.AddAsync(entity);
                }

                await context.SaveChangesAsync();
            }

            if (!context.IdentityResources.Any())
            {
                var identityResources = Configuration.GetIdentityResources().ToList();

                foreach (var resource in identityResources)
                {
                    await context.IdentityResources.AddAsync(resource.ToEntity());
                }

                await context.SaveChangesAsync();
            }

            if (!context.ApiResources.Any())
            {
                foreach (var resource in Configuration.GetApiResources().ToList())
                {
                    await context.ApiResources.AddAsync(resource.ToEntity());
                }

                await context.SaveChangesAsync();
            }
        }
Beispiel #2
0
 public Repository(IDS4DbContext dbContext)
 {
     DbContext = dbContext;
     DbSet     = DbContext.Set <TEntity>();
 }
Beispiel #3
0
 public LoginLogRepository(IDS4DbContext dbContext) : base(dbContext)
 {
 }
 public ApiScopeRepository(IDS4DbContext dbContext) : base(dbContext)
 {
 }
Beispiel #5
0
 public ApiSecretRepository(IDS4DbContext dbContext)
     : base(dbContext)
 {
 }
 public ClientClaimRepository(IDS4DbContext dbContext) : base(dbContext)
 {
 }
 public ClientSecretRepository(IDS4DbContext dbContext) : base(dbContext)
 {
 }
 public UnitOfWork(IDS4DbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public ApiResourceRepository(IDS4DbContext dbContext)
     : base(dbContext)
 {
 }
Beispiel #10
0
 public IdentityResourceRepository(IDS4DbContext dbContext)
     : base(dbContext)
 {
 }
 public StartupRepository(IDS4DbContext dbContext) : base(dbContext)
 {
 }
 public ClientPropertyRepository(IDS4DbContext dbContext) : base(dbContext)
 {
 }