Exemplo n.º 1
0
        public SharedDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <SharedDbContext>();
            var configuration = AppConfigurations.Get(AppDomain.CurrentDomain.BaseDirectory);

            SharedDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SharedConsts.SharedConnectionStringName));

            return(new SharedDbContext(builder.Options));
        }
Exemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <SharedDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 SharedDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 var connectionString = AppConfigurations.GetConnectionString(options.DbContextOptions.Options.ContextType.ToString());
                 SharedDbContextConfigurer.Configure(options.DbContextOptions, connectionString);
             }
         });
     }
 }