示例#1
0
        public K9AbpDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <K9AbpDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.FindConfigurationFolder());

            K9AbpDbContextConfigurer.Configure(builder, configuration.GetConnectionString(K9AbpConsts.ConnectionStringName));

            return(new K9AbpDbContext(builder.Options));
        }
示例#2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <K9AbpDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 K9AbpDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 K9AbpDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }