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

            DotNetCoreWebApiProjectDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DotNetCoreWebApiProjectConsts.ConnectionStringName));

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