Beispiel #1
0
        public AceDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <AceDbContext>();
            var configPath    = new DirectoryInfo(typeof(AceEntityFrameworkModule).GetAssembly().Location).Parent.FullName + "\\Configuration";
            var configuration = AppConfigurations.Get(configPath);

            DbContextConfigurer.Configure(builder, configuration.GetConnectionString(AceConsts.ConnectionStringName));
            return(new AceDbContext(builder.Options));
        }
 private void AddDbContext <TDbContext>() where TDbContext : AbpDbContext
 {
     Configuration.Modules.AbpEfCore().AddDbContext <TDbContext>(options =>
     {
         if (options.ExistingConnection != null)
         {
             DbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
         }
         else
         {
             DbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
         }
     });
 }