Browse Source

Add GetEntityFrameworkCoreProjectFolderPath.

pull/9194/head
maliming 5 years ago
parent
commit
5fd766e4eb
  1. 10
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs

10
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs

@ -144,14 +144,14 @@ namespace MyCompanyName.MyProjectName.Data
private bool DbMigrationsProjectExists() private bool DbMigrationsProjectExists()
{ {
var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath(); var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath();
return dbMigrationsProjectFolder != null; return dbMigrationsProjectFolder != null;
} }
private bool MigrationsFolderExists() private bool MigrationsFolderExists()
{ {
var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath(); var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath();
return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations"));
} }
@ -175,7 +175,7 @@ namespace MyCompanyName.MyProjectName.Data
} }
var procStartInfo = new ProcessStartInfo(fileName, var procStartInfo = new ProcessStartInfo(fileName,
$"{argumentPrefix} \"abp create-migration-and-run-migrator \"{GetDbMigrationsProjectFolderPath()}\"\"" $"{argumentPrefix} \"abp create-migration-and-run-migrator \"{GetEntityFrameworkCoreProjectFolderPath()}\"\""
); );
try try
@ -188,7 +188,7 @@ namespace MyCompanyName.MyProjectName.Data
} }
} }
private string GetDbMigrationsProjectFolderPath() private string GetEntityFrameworkCoreProjectFolderPath()
{ {
var slnDirectoryPath = GetSolutionDirectoryPath(); var slnDirectoryPath = GetSolutionDirectoryPath();
@ -200,7 +200,7 @@ namespace MyCompanyName.MyProjectName.Data
var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src"); var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src");
return Directory.GetDirectories(srcDirectoryPath) return Directory.GetDirectories(srcDirectoryPath)
.FirstOrDefault(d => d.EndsWith(".DbMigrations")); .FirstOrDefault(d => d.EndsWith(".EntityFrameworkCore"));
} }
private string GetSolutionDirectoryPath() private string GetSolutionDirectoryPath()

Loading…
Cancel
Save