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

            AfarsoftResourcePlanDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AfarsoftResourcePlanConsts.ConnectionStringName));

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