Beispiel #1
0
        public EMDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <EMDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            EMDbContextConfigurer.Configure(builder, configuration.GetConnectionString(EMConsts.ConnectionStringName));

            return(new EMDbContext(builder.Options));
        }
Beispiel #2
0
 public override void PreInitialize()
 {
     Configuration.UnitOfWork.IsTransactional = false;
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <EMDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 EMDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 EMDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }