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

            StockSystemDbContextConfigurer.Configure(builder, configuration.GetConnectionString(StockSystemConsts.ConnectionStringName));

            return(new StockSystemDbContext(builder.Options));
        }
Ejemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <StockSystemDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 StockSystemDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 StockSystemDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }