Example #1
0
 public EFProject(string?projectPath, EfEXLog efLog)
 {
     _efLog        = efLog;
     ProjectPath   = GetProjectPath(projectPath);
     MigrationPath = GetMigrationPath();
     SqlPath       = GetSqlPath();
 }
Example #2
0
        static void HandleMigrationSqlAdd(string?projectPath, bool verbose, IConsole console)
        {
            var efLog   = new EfEXLog(console, verbose);
            var project = new EFProject(projectPath, efLog);

            efLog.LogVerbose("Validated all required project paths");
            var migrations = new EFExSqlDesigner(project, efLog);
        }
Example #3
0
 public EFExSqlDesigner(EFProject proj, EfEXLog log)
 {
     Migrations = new Dictionary <string, EFEXSqlMigration?>();
     foreach (var file in Directory.GetFiles(proj.MigrationPath))
     {
         if (!file.ToLower().EndsWith(".sql.designer.json"))
         {
             continue;
         }
         log.LogVerbose($"Processing designer file {file}");
         var jsonString    = File.ReadAllText(file);
         var fileName      = Path.GetFileName(file);
         var migrationName = fileName.ToLower().Replace(".sql.designer.json", "");
         log.LogVerbose($"Migration name found to be {migrationName}");
         var migObject = JsonSerializer.Deserialize <EFEXSqlMigration>(jsonString);
         Migrations.Add(migrationName, migObject);
         log.LogVerbose($"Successfully deserialized migration json file {file} for processing");
     }
 }