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

            MyCompanyDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyCompanyConsts.ConnectionStringName));

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