public virtual int AddMigration([NotNull] string name, [CanBeNull] string context) { Check.NotEmpty(name, "name"); var migration = _migrationTool.AddMigration(name, _rootNamespace, context); _migrationTool.WriteMigration(_projectDir, migration, _rootNamespace).ToArray(); return(0); }
public virtual int AddMigration([CanBeNull] string name, [CanBeNull] string context) { if (string.IsNullOrEmpty(name)) { _app.ShowHelp("migration add"); return(1); } _migrationTool.AddMigration(name, context, _rootNamespace, _projectDir).ToArray(); return(0); }
public virtual int AddMigration([CanBeNull] string name, [CanBeNull] string context, [CanBeNull] string startupProject) { return(Execute( startupProject, () => { _migrationTool.AddMigration(name, context, _rootNamespace, _projectDir); _logger.LogInformation("Done. To undo this action, use 'ef migration remove'."); return 0; })); }
static void Main(string[] args) { var loggr = new ConsoleLoggerProvider((p, q)=>String.IsNullOrWhiteSpace(p) && ((int)q) > 4); var assmbly = typeof(Program).Assembly; var mig = new MigrationTool(loggr, typeof(Program).Assembly); mig.AddMigration( $"{DateTimeOffset.Now.Ticks}", nameof(SampleContext), nameof(assmbly), "consoleEf7", @"C:\git\consoleEf7\consoleEf7"); /* if (args[1] == "migrator") { switch((MigrationPaths)Enum.Parse(typeof(MigrationPaths), args[2])) { case MigrationPaths.Add: mig.AddMigration( args[3] ?? $"{DateTimeOffset.Now.Ticks}", nameof(SampleContext), nameof(assmbly), "consoleEf7", @"C:\git\consoleEf7\consoleEf7"); break; case MigrationPaths.Apply: break; case MigrationPaths.Remove: break; case MigrationPaths.Rollback: break; case MigrationPaths.Idempotent: break; default: break; } } */ Console.WriteLine("Success for Ef7!"); Console.ReadLine(); }
public virtual int AddMigration([CanBeNull] string name, [CanBeNull] string context, [CanBeNull] string startupProject) { if (string.IsNullOrEmpty(name)) { _app.Commands.Single(c => c.Name == "migration").ShowHelp("add"); return(1); } return(ExecuteInDirectory( startupProject, () => { _migrationTool.AddMigration(name, context, _rootNamespace, _projectDir); return 0; })); }