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

            EbseneDbContextConfigurer.Configure(builder, configuration.GetConnectionString(EbseneConsts.ConnectionStringName));

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