protected void ModifyDbContext(string[] projectFiles, ModuleInfo module, bool skipDbMigrations = false) { if (string.IsNullOrWhiteSpace(module.EfCoreConfigureMethodName)) { if (!skipDbMigrations) { RunMigrator(projectFiles); } return; } var dbMigrationsProject = projectFiles.FirstOrDefault(p => p.EndsWith(".DbMigrations.csproj")) ?? projectFiles.FirstOrDefault(p => p.EndsWith(".EntityFrameworkCore.csproj")); if (dbMigrationsProject == null) { Logger.LogDebug("Solution doesn't have a Migrations project."); if (!skipDbMigrations) { RunMigrator(projectFiles); } return; } var dbContextFile = DerivedClassFinder.Find(dbMigrationsProject, "AbpDbContext").FirstOrDefault(); if (dbContextFile == null) { Logger.LogDebug( $"{dbMigrationsProject} project doesn't have a class that is derived from \"AbpDbContext\"."); return; } var addedNewBuilder = DbContextFileBuilderConfigureAdder.Add(dbContextFile, module.EfCoreConfigureMethodName); if (!skipDbMigrations) { if (addedNewBuilder) { EfCoreMigrationManager.AddMigration(dbMigrationsProject, module.Name); } RunMigrator(projectFiles); } }
public SolutionModuleAdder( IJsonSerializer jsonSerializer, ProjectNugetPackageAdder projectNugetPackageAdder, DbContextFileBuilderConfigureAdder dbContextFileBuilderConfigureAdder, EfCoreMigrationManager efCoreMigrationManager, DerivedClassFinder derivedClassFinder, ProjectNpmPackageAdder projectNpmPackageAdder, NpmGlobalPackagesChecker npmGlobalPackagesChecker, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, SourceCodeDownloadService sourceCodeDownloadService, SolutionFileModifier solutionFileModifier, NugetPackageToLocalReferenceConverter nugetPackageToLocalReferenceConverter, AngularSourceCodeAdder angularSourceCodeAdder, NewCommand newCommand, BundleCommand bundleCommand, CliHttpClientFactory cliHttpClientFactory, ICmdHelper cmdHelper, ILocalEventBus localEventBus) { JsonSerializer = jsonSerializer; ProjectNugetPackageAdder = projectNugetPackageAdder; DbContextFileBuilderConfigureAdder = dbContextFileBuilderConfigureAdder; EfCoreMigrationManager = efCoreMigrationManager; DerivedClassFinder = derivedClassFinder; ProjectNpmPackageAdder = projectNpmPackageAdder; NpmGlobalPackagesChecker = npmGlobalPackagesChecker; RemoteServiceExceptionHandler = remoteServiceExceptionHandler; SourceCodeDownloadService = sourceCodeDownloadService; SolutionFileModifier = solutionFileModifier; NugetPackageToLocalReferenceConverter = nugetPackageToLocalReferenceConverter; AngularSourceCodeAdder = angularSourceCodeAdder; NewCommand = newCommand; BundleCommand = bundleCommand; CmdHelper = cmdHelper; LocalEventBus = localEventBus; _cliHttpClientFactory = cliHttpClientFactory; Logger = NullLogger <SolutionModuleAdder> .Instance; }
public ProjectNugetPackageAdder( IJsonSerializer jsonSerializer, ProjectNpmPackageAdder npmPackageAdder, DerivedClassFinder moduleClassFinder, ModuleClassDependcyAdder moduleClassDependcyAdder, IRemoteServiceExceptionHandler remoteServiceExceptionHandler, BundleCommand bundleCommand, CliHttpClientFactory cliHttpClientFactory, SourceCodeDownloadService sourceCodeDownloadService, SolutionFileModifier solutionFileModifier, ICmdHelper cmdHelper) { JsonSerializer = jsonSerializer; NpmPackageAdder = npmPackageAdder; ModuleClassFinder = moduleClassFinder; ModuleClassDependcyAdder = moduleClassDependcyAdder; RemoteServiceExceptionHandler = remoteServiceExceptionHandler; BundleCommand = bundleCommand; SourceCodeDownloadService = sourceCodeDownloadService; SolutionFileModifier = solutionFileModifier; CmdHelper = cmdHelper; _cliHttpClientFactory = cliHttpClientFactory; Logger = NullLogger <ProjectNugetPackageAdder> .Instance; }