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

            TankMonitorDemoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TankMonitorDemoConsts.ConnectionStringName));

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