public T CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <T>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            DbContextOptionsConfigurer.Configure(
                builder,
                configuration.GetConnectionString(ConnectionStringName)
                );
            return(this.CreateDbContext(builder.Options));
        }
Beispiel #2
0
 private void AddDbContext <TDbContext>()
     where TDbContext : AbpDbContext
 {
     Configuration.Modules.AbpEfCore().AddDbContext <TDbContext>(options =>
     {
         if (options.ExistingConnection != null)
         {
             DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
         }
         else
         {
             DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
         }
     });
 }