public CreateMigrationAndRunMigratorCommand(ICmdHelper cmdHelper, InitialMigrationCreator initialMigrationCreator, DotnetEfToolManager dotnetEfToolManager) { _initialMigrationCreator = initialMigrationCreator; CmdHelper = cmdHelper; DotnetEfToolManager = dotnetEfToolManager; Logger = NullLogger <CreateMigrationAndRunMigratorCommand> .Instance; }
public NewCommand(TemplateProjectBuilder templateProjectBuilder , ITemplateInfoProvider templateInfoProvider, ConnectionStringProvider connectionStringProvider, SolutionPackageVersionFinder solutionPackageVersionFinder, ICmdHelper cmdHelper, IInstallLibsService installLibsService, AngularPwaSupportAdder angularPwaSupportAdder, InitialMigrationCreator initialMigrationCreator, ThemePackageAdder themePackageAdder, ILocalEventBus eventBus) : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper, installLibsService, angularPwaSupportAdder, initialMigrationCreator, themePackageAdder, eventBus) { TemplateProjectBuilder = templateProjectBuilder; TemplateInfoProvider = templateInfoProvider; }
protected async Task CreateInitialMigrationsAsync(ProjectBuildArgs projectArgs) { if (projectArgs.DatabaseProvider == DatabaseProvider.MongoDb) { return; } var efCoreProjectPath = string.Empty; bool isLayeredTemplate; switch (projectArgs.TemplateName) { case AppTemplate.TemplateName: case AppProTemplate.TemplateName: efCoreProjectPath = Directory.GetFiles(projectArgs.OutputFolder, "*EntityFrameworkCore.csproj", SearchOption.AllDirectories).FirstOrDefault(); isLayeredTemplate = true; break; case AppNoLayersTemplate.TemplateName: case AppNoLayersProTemplate.TemplateName: efCoreProjectPath = Directory.GetFiles(projectArgs.OutputFolder, "*.csproj", SearchOption.AllDirectories).FirstOrDefault(); isLayeredTemplate = false; break; default: return; } if (string.IsNullOrWhiteSpace(efCoreProjectPath)) { Logger.LogWarning("Couldn't find the project to create initial migrations!"); return; } await EventBus.PublishAsync(new ProjectCreationProgressEvent { Message = "Creating the initial DB migration" }, false); await InitialMigrationCreator.CreateAsync(Path.GetDirectoryName(efCoreProjectPath), isLayeredTemplate); }
public ProjectCreationCommandBase( ConnectionStringProvider connectionStringProvider, SolutionPackageVersionFinder solutionPackageVersionFinder, ICmdHelper cmdHelper, IInstallLibsService installLibsService, AngularPwaSupportAdder angularPwaSupportAdder, InitialMigrationCreator initialMigrationCreator, ThemePackageAdder themePackageAdder, ILocalEventBus eventBus) { ConnectionStringProvider = connectionStringProvider; SolutionPackageVersionFinder = solutionPackageVersionFinder; CmdHelper = cmdHelper; InstallLibsService = installLibsService; AngularPwaSupportAdder = angularPwaSupportAdder; InitialMigrationCreator = initialMigrationCreator; EventBus = eventBus; ThemePackageAdder = themePackageAdder; Logger = NullLogger <NewCommand> .Instance; }