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

            BackEndDbContextConfigurer.Configure(builder, configuration.GetConnectionString(BackEndConsts.ConnectionStringName));

            return(new BackEndDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <BackEndDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 BackEndDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 BackEndDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }