public static CommandLineApplication Create(ref string[] args) { EnsureValidDispatchRecipient(ref args); var app = new CommandLineApplication() { // Technically, the real "dotnet-ef.dll" is in Microsoft.EntityFrameworkCore.Tools, // but this name is what the help usage displays Name = "dotnet ef", FullName = "Entity Framework .NET Core CLI Commands" }; app.HelpOption(); app.VerboseOption(); app.VersionOption(GetVersion); var commonOptions = new CommonCommandOptions { // required Assembly = app.Option(AssemblyOptionTemplate + " <ASSEMBLY>", "The assembly file to load."), // optional StartupAssembly = app.Option(StartupAssemblyOptionTemplate + " <ASSEMBLY>", "The assembly file containing the startup class."), DataDirectory = app.Option(DataDirectoryOptionTemplate + " <DIR>", "The folder used as the data directory (defaults to current working directory)."), ProjectDirectory = app.Option(ProjectDirectoryOptionTemplate + " <DIR>", "The folder used as the project directory (defaults to current working directory)."), ContentRootPath = app.Option(ContentRootPathOptionTemplate + " <DIR>", "The folder used as the content root path for the application (defaults to application base directory)."), RootNamespace = app.Option(RootNamespaceOptionTemplate + " <NAMESPACE>", "The root namespace of the target project (defaults to the project assembly name).") }; app.Command("database", c => DatabaseCommand.Configure(c, commonOptions)); app.Command("dbcontext", c => DbContextCommand.Configure(c, commonOptions)); app.Command("migrations", c => MigrationsCommand.Configure(c, commonOptions)); app.OnExecute( () => { WriteLogo(); app.ShowHelp(); }); return(app); }
public static CommandLineApplication Create() { var app = new CommandLineApplication() { Name = GetToolName(), FullName = "Entity Framework .NET Core CLI Commands" }; app.HelpOption(); app.VerboseOption(); app.VersionOption(GetVersion); var commonOptions = new CommonCommandOptions { Framework = app.Option(FrameworkOptionTemplate + " <FRAMEWORK>", "Target framework to load", CommandOptionType.SingleValue), Configuration = app.Option(ConfigOptionTemplate + " <CONFIGURATION>", "Configuration under which to load", CommandOptionType.SingleValue), BuildBasePath = app.Option(BuildBasePathOptionTemplate + " <OUTPUT_DIR>", "Directory in which to find temporary outputs", CommandOptionType.SingleValue), NoBuild = app.Option(NoBuildOptionTemplate, "Do not build before executing", CommandOptionType.NoValue) }; app.Command("database", c => DatabaseCommand.Configure(c, commonOptions)); app.Command("dbcontext", c => DbContextCommand.Configure(c, commonOptions)); app.Command("migrations", c => MigrationsCommand.Configure(c, commonOptions)); app.OnExecute( () => { WriteLogo(); app.ShowHelp(); }); return(app); }
public static CommandLineApplication Create() { var app = new CommandLineApplication() { // Technically, the real "dotnet-ef.dll" is in Microsoft.EntityFrameworkCore.Tools, // but this name is what the help usage displays Name = "dotnet ef", FullName = "Entity Framework .NET Core CLI Commands" }; app.HelpOption(); app.VerboseOption(); app.VersionOption(GetVersion); var commonOptions = new CommonCommandOptions { Framework = app.Option(FrameworkOptionTemplate + " <FRAMEWORK>", "Target framework to load", CommandOptionType.SingleValue), Configuration = app.Option(ConfigOptionTemplate + " <CONFIGURATION>", "Configuration under which to load", CommandOptionType.SingleValue) }; app.Command("database", c => DatabaseCommand.Configure(c, commonOptions)); app.Command("dbcontext", c => DbContextCommand.Configure(c, commonOptions)); app.Command("migrations", c => MigrationsCommand.Configure(c, commonOptions)); app.OnExecute( () => { WriteLogo(); app.ShowHelp(); }); return(app); }