Exemplo n.º 1
0
        public IdentityServerDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <IdentityServerDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            IdentityServerDbContextConfigurer.Configure(builder, configuration.GetConnectionString(IdentityServerConsts.ConnectionStringName));

            return(new IdentityServerDbContext(builder.Options));
        }
        public DbContextOptions <IdentityServerConfigurationDbContext> GetDbContextOption()
        {
            var builder = new DbContextOptionsBuilder <IdentityServerConfigurationDbContext>();

            //var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            //MyDocumentManageDbContextConfigurer.Configure(builder, configuration.GetConnectionString("mydb"));

            IdentityServerDbContextConfigurer.Configure(builder, AppConfigurtaionServices.GetAppSettings()["ConnectionStrings:mydb"]);
            return(builder.Options);
        }
        public IdentityServerConfigurationDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <IdentityServerConfigurationDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());
            var connString    = configuration.GetConnectionString(IdentityServerConsts.ConnectionStringName);

            IdentityServerDbContextConfigurer.Configure(builder, connString);

            ConfigurationStoreOptions storeOptions = new ConfigurationStoreOptions();

            storeOptions.ConfigureDbContext = builder1 =>
                                              builder1.UseMySql(connString, sql => sql.MigrationsAssembly("Zya.IdentityServer.EntityFrameworkCore"));

            return(new IdentityServerConfigurationDbContext(builder.Options, storeOptions));
        }
Exemplo n.º 4
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <IdentityServerDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 IdentityServerDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 IdentityServerDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }