public List <string> GetDbContextNames(FindDbContextSubtypeParams commandParams) { var result = runMigratorProcess(commandParams); if (!string.IsNullOrEmpty(result.error)) { #pragma warning disable VSTHRD110 // Observe result of async calls _messageBoxService.ShowErrorMessage(result.error); #pragma warning restore VSTHRD110 // Observe result of async calls } if (result.exitCode == ExitCode.Success) { if (!string.IsNullOrWhiteSpace(result.output)) { return(result.output.Split(';').ToList()); } } else if (result.exitCode == ExitCode.Exception && !string.IsNullOrWhiteSpace(result.output)) { #pragma warning disable VSTHRD110 // Observe result of async calls _messageBoxService.ShowErrorMessage(result.output); #pragma warning restore VSTHRD110 // Observe result of async calls } return(new List <string>()); }
static int Main(string[] args) { if (args == null || args.Length == 0) { return(ExitCode.InvalidArguments); } try { if (args[0] == CommandType.AddMigration) { var commandParams = AddMigrationParams.FromArgumentsArray(args); return(new AddMigrationExecutor().Run(commandParams)); } else if (args[0] == CommandType.ScriptMigration) { var commandParams = ScriptMigrationParams.FromArgumentsArray(args); return(new ScriptMigrationExecutor().Run(commandParams)); } else if (args[0] == CommandType.FindDbContextSubtypes) { var commandParams = FindDbContextSubtypeParams.FromArgumentsArray(args); var types = TypeFinder.GetDbContextTypeFullNamesFromAssebly(commandParams.AssemblyFileName); return(writeResult(types)); } else if (args[0] == CommandType.FindMigrationSubtypes) { var commandParams = FindMigrationSubtypeParams.FromArgumentsArray(args); var types = TypeFinder.GetMigrationByDbContextFromAssebly(commandParams.AssemblyFileName); return(writeResult(types)); } } catch (InvalidOperationException) { return(ExitCode.CanNotFindDbContext); } catch (FileNotFoundException e) { LogException(e); return(ExitCode.CanNotFindFile); } catch (ArgumentException e) { LogException(e); return(ExitCode.InvalidArguments); } catch (Exception e) { LogException(e); return(ExitCode.Exception); } return(ExitCode.InvalidCommand); }