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

            PracticeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PracticeConsts.ConnectionStringName));

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