diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/CommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/CommandHandler.cs
index d8cc9c1..dcf7a22 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/CommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/CommandHandler.cs
@@ -10,10 +10,12 @@
namespace GenAIDBExplorer.Console.CommandHandlers;
///
-/// Abstract base class for command handlers.
+/// Abstract base class for command handlers using System.CommandLine 2.0.0-beta5 API patterns.
///
///
/// This class provides common utility functionality for handling console commands.
+/// With System.CommandLine beta5, command handlers use ParseResult parameters
+/// and SetAction methods instead of the previous SetHandler patterns.
///
///
/// Initializes a new instance of the class.
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/DataDictionaryCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/DataDictionaryCommandHandler.cs
index 5d50c76..f3707c8 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/DataDictionaryCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/DataDictionaryCommandHandler.cs
@@ -40,7 +40,7 @@ ILogger> logger
private readonly IDataDictionaryProvider _dataDictionaryProvider = serviceProvider.GetRequiredService();
///
- /// Sets up the data-dictionary command.
+ /// Sets up the data-dictionary command using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The data-dictionary command.
@@ -51,7 +51,7 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var sourcePathOption = new Option(
@@ -59,7 +59,7 @@ public static Command SetupCommand(IHost host)
description: "The path to the source directory containing data dictionary files. Supports file masks."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var schemaNameOption = new Option(
@@ -67,7 +67,7 @@ public static Command SetupCommand(IHost host)
description: "The schema name of the object to process."
)
{
- ArgumentHelpName = "schemaName"
+ HelpName = "schemaName" // Updated from ArgumentHelpName for beta5 compatibility
};
var nameOption = new Option(
@@ -75,7 +75,7 @@ public static Command SetupCommand(IHost host)
description: "The name of the object to process."
)
{
- ArgumentHelpName = "name"
+ HelpName = "name" // Updated from ArgumentHelpName for beta5 compatibility
};
var showOption = new Option(
@@ -84,21 +84,24 @@ public static Command SetupCommand(IHost host)
getDefaultValue: () => false
);
- var dataDictionaryCommand = new Command("data-dictionary", "Process data dictionary files and update the semantic model.")
- {
- projectPathOption
- };
-
- var tableCommand = new Command("table", "Process table data dictionary files.")
- {
- projectPathOption,
- sourcePathOption,
- schemaNameOption,
- nameOption,
- showOption
- };
- tableCommand.SetHandler(async (DirectoryInfo projectPath, string sourcePathPattern, string schemaName, string name, bool show) =>
+ var dataDictionaryCommand = new Command("data-dictionary", "Process data dictionary files and update the semantic model.");
+ dataDictionaryCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+
+ var tableCommand = new Command("table", "Process table data dictionary files.");
+ tableCommand.Options.Add(projectPathOption);
+ tableCommand.Options.Add(sourcePathOption);
+ tableCommand.Options.Add(schemaNameOption);
+ tableCommand.Options.Add(nameOption);
+ tableCommand.Options.Add(showOption);
+
+ tableCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var sourcePathPattern = parseResult.GetValue(sourcePathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+ var show = parseResult.GetValue(showOption);
+
var handler = host.Services.GetRequiredService();
var options = new DataDictionaryCommandHandlerOptions(
projectPath,
@@ -109,9 +112,9 @@ public static Command SetupCommand(IHost host)
show: show
);
await handler.HandleAsync(options);
- }, projectPathOption, sourcePathOption, schemaNameOption, nameOption, showOption);
+ });
- dataDictionaryCommand.AddCommand(tableCommand);
+ dataDictionaryCommand.Subcommands.Add(tableCommand); // Updated from AddCommand for beta5 compatibility
return dataDictionaryCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/EnrichModelCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/EnrichModelCommandHandler.cs
index d8b2795..ced5c83 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/EnrichModelCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/EnrichModelCommandHandler.cs
@@ -34,7 +34,7 @@ ILogger> logger
private readonly ISemanticDescriptionProvider _semanticDescriptionProvider = serviceProvider.GetRequiredService();
///
- /// Sets up the enrich-model command.
+ /// Sets up the enrich-model command using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The enrich-model command.
@@ -45,7 +45,7 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var skipTablesOption = new Option(
@@ -71,7 +71,7 @@ public static Command SetupCommand(IHost host)
description: "The schema name of the object to enrich."
)
{
- ArgumentHelpName = "schemaName"
+ HelpName = "schemaName" // Updated from ArgumentHelpName for beta5 compatibility
};
var nameOption = new Option(
@@ -79,7 +79,7 @@ public static Command SetupCommand(IHost host)
description: "The name of the object to enrich."
)
{
- ArgumentHelpName = "name"
+ HelpName = "name" // Updated from ArgumentHelpName for beta5 compatibility
};
var showOption = new Option(
@@ -88,25 +88,27 @@ public static Command SetupCommand(IHost host)
getDefaultValue: () => false
);
- // Create the base 'enrich-model' command
- var enrichModelCommand = new Command("enrich-model", "Enrich an existing semantic model with descriptions in a GenAI Database Explorer project.")
- {
- projectPathOption,
- skipTablesOption,
- skipViewsOption,
- skipStoredProceduresOption
- };
+ // Create the base 'enrich-model' command with beta5 mutable collections API
+ var enrichModelCommand = new Command("enrich-model", "Enrich an existing semantic model with descriptions in a GenAI Database Explorer project.");
+ enrichModelCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+ enrichModelCommand.Options.Add(skipTablesOption);
+ enrichModelCommand.Options.Add(skipViewsOption);
+ enrichModelCommand.Options.Add(skipStoredProceduresOption);
// Create subcommands
- var tableCommand = new Command("table", "Enrich a specific table.")
- {
- projectPathOption,
- schemaNameOption,
- nameOption,
- showOption
- };
- tableCommand.SetHandler(async (DirectoryInfo projectPath, string schemaName, string name, bool show) =>
+ var tableCommand = new Command("table", "Enrich a specific table.");
+ tableCommand.Options.Add(projectPathOption);
+ tableCommand.Options.Add(schemaNameOption);
+ tableCommand.Options.Add(nameOption);
+ tableCommand.Options.Add(showOption);
+
+ tableCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+ var show = parseResult.GetValue(showOption);
+
var handler = host.Services.GetRequiredService();
var options = new EnrichModelCommandHandlerOptions(
projectPath,
@@ -119,17 +121,21 @@ public static Command SetupCommand(IHost host)
show: show
);
await handler.HandleAsync(options);
- }, projectPathOption, schemaNameOption, nameOption, showOption);
+ });
- var viewCommand = new Command("view", "Enrich a specific view.")
- {
- projectPathOption,
- schemaNameOption,
- nameOption,
- showOption
- };
- viewCommand.SetHandler(async (DirectoryInfo projectPath, string schemaName, string name, bool show) =>
+ var viewCommand = new Command("view", "Enrich a specific view.");
+ viewCommand.Options.Add(projectPathOption);
+ viewCommand.Options.Add(schemaNameOption);
+ viewCommand.Options.Add(nameOption);
+ viewCommand.Options.Add(showOption);
+
+ viewCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+ var show = parseResult.GetValue(showOption);
+
var handler = host.Services.GetRequiredService();
var options = new EnrichModelCommandHandlerOptions(
projectPath,
@@ -142,17 +148,21 @@ public static Command SetupCommand(IHost host)
show: show
);
await handler.HandleAsync(options);
- }, projectPathOption, schemaNameOption, nameOption, showOption);
+ });
- var storedProcedureCommand = new Command("storedprocedure", "Enrich a specific stored procedure.")
- {
- projectPathOption,
- schemaNameOption,
- nameOption,
- showOption
- };
- storedProcedureCommand.SetHandler(async (DirectoryInfo projectPath, string schemaName, string name, bool show) =>
+ var storedProcedureCommand = new Command("storedprocedure", "Enrich a specific stored procedure.");
+ storedProcedureCommand.Options.Add(projectPathOption);
+ storedProcedureCommand.Options.Add(schemaNameOption);
+ storedProcedureCommand.Options.Add(nameOption);
+ storedProcedureCommand.Options.Add(showOption);
+
+ storedProcedureCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+ var show = parseResult.GetValue(showOption);
+
var handler = host.Services.GetRequiredService();
var options = new EnrichModelCommandHandlerOptions(
projectPath,
@@ -165,20 +175,25 @@ public static Command SetupCommand(IHost host)
show: show
);
await handler.HandleAsync(options);
- }, projectPathOption, schemaNameOption, nameOption, showOption);
+ });
- // Add subcommands to the 'enrich-model' command
- enrichModelCommand.AddCommand(tableCommand);
- enrichModelCommand.AddCommand(viewCommand);
- enrichModelCommand.AddCommand(storedProcedureCommand);
+ // Add subcommands to the 'enrich-model' command using beta5 mutable collections API
+ enrichModelCommand.Subcommands.Add(tableCommand); // Updated from AddCommand for beta5 compatibility
+ enrichModelCommand.Subcommands.Add(viewCommand);
+ enrichModelCommand.Subcommands.Add(storedProcedureCommand);
// Set default handler if no subcommand is provided
- enrichModelCommand.SetHandler(async (DirectoryInfo projectPath, bool skipTables, bool skipViews, bool skipStoredProcedures) =>
+ enrichModelCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var skipTables = parseResult.GetValue(skipTablesOption);
+ var skipViews = parseResult.GetValue(skipViewsOption);
+ var skipStoredProcedures = parseResult.GetValue(skipStoredProceduresOption);
+
var handler = host.Services.GetRequiredService();
var options = new EnrichModelCommandHandlerOptions(projectPath, skipTables, skipViews, skipStoredProcedures);
await handler.HandleAsync(options);
- }, projectPathOption, skipTablesOption, skipViewsOption, skipStoredProceduresOption);
+ });
return enrichModelCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExportModelCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExportModelCommandHandler.cs
index 727d330..8c4fc6d 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExportModelCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExportModelCommandHandler.cs
@@ -41,7 +41,7 @@ ILogger> logger
}
///
- /// Sets up the export-model command.
+ /// Sets up the export-model command using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The export-model command.
@@ -52,7 +52,7 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var outputFileNameOption = new Option(
@@ -73,17 +73,22 @@ public static Command SetupCommand(IHost host)
);
var exportModelCommand = new Command("export-model", "Export the semantic model from a GenAI Database Explorer project.");
- exportModelCommand.AddOption(projectPathOption);
- exportModelCommand.AddOption(outputFileNameOption);
- exportModelCommand.AddOption(fileTypeOption);
- exportModelCommand.AddOption(splitFilesOption);
+ exportModelCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+ exportModelCommand.Options.Add(outputFileNameOption);
+ exportModelCommand.Options.Add(fileTypeOption);
+ exportModelCommand.Options.Add(splitFilesOption);
- exportModelCommand.SetHandler(async (DirectoryInfo projectPath, string? outputFileName, string fileType, bool splitFiles) =>
+ exportModelCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var outputFileName = parseResult.GetValue(outputFileNameOption);
+ var fileType = parseResult.GetValue(fileTypeOption);
+ var splitFiles = parseResult.GetValue(splitFilesOption);
+
var handler = host.Services.GetRequiredService();
var options = new ExportModelCommandHandlerOptions(projectPath, outputFileName, fileType, splitFiles);
await handler.HandleAsync(options);
- }, projectPathOption, outputFileNameOption, fileTypeOption, splitFilesOption);
+ });
return exportModelCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExtractModelCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExtractModelCommandHandler.cs
index 0db20fc..74884d4 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExtractModelCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ExtractModelCommandHandler.cs
@@ -33,7 +33,7 @@ ILogger> logger
private static readonly ResourceManager _resourceManagerLogMessages = new("GenAIDBExplorer.Console.Resources.LogMessages", typeof(ExtractModelCommandHandler).Assembly);
///
- /// Sets up the extract model command.
+ /// Sets up the extract model command using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The extract model command.
@@ -44,7 +44,7 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var skipTablesOption = new Option(
@@ -66,16 +66,22 @@ public static Command SetupCommand(IHost host)
);
var extractModelCommand = new Command("extract-model", "Extract a semantic model from a SQL database for a GenAI Database Explorer project.");
- extractModelCommand.AddOption(projectPathOption);
- extractModelCommand.AddOption(skipTablesOption);
- extractModelCommand.AddOption(skipViewsOption);
- extractModelCommand.AddOption(skipStoredProceduresOption);
- extractModelCommand.SetHandler(async (DirectoryInfo projectPath, bool skipTables, bool skipViews, bool skipStoredProcedures) =>
+ extractModelCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+ extractModelCommand.Options.Add(skipTablesOption);
+ extractModelCommand.Options.Add(skipViewsOption);
+ extractModelCommand.Options.Add(skipStoredProceduresOption);
+
+ extractModelCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var skipTables = parseResult.GetValue(skipTablesOption);
+ var skipViews = parseResult.GetValue(skipViewsOption);
+ var skipStoredProcedures = parseResult.GetValue(skipStoredProceduresOption);
+
var handler = host.Services.GetRequiredService();
var options = new ExtractModelCommandHandlerOptions(projectPath, skipTables, skipViews, skipStoredProcedures);
await handler.HandleAsync(options);
- }, projectPathOption, skipTablesOption, skipViewsOption, skipStoredProceduresOption);
+ });
return extractModelCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ICommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ICommandHandler.cs
index b3028ba..5d7deb6 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ICommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ICommandHandler.cs
@@ -5,10 +5,11 @@
namespace GenAIDBExplorer.Console.CommandHandlers;
///
-/// Defines the contract for a command handler.
+/// Defines the contract for a command handler using System.CommandLine 2.0.0-beta5 patterns.
///
///
/// Implementations of this interface are responsible for handling commands with specified options.
+/// With System.CommandLine beta5, handlers use ParseResult parameters instead of individual typed parameters.
///
public interface ICommandHandler where TOptions : ICommandHandlerOptions
{
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/InitProjectCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/InitProjectCommandHandler.cs
index 04872e1..5d01f89 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/InitProjectCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/InitProjectCommandHandler.cs
@@ -33,7 +33,7 @@ ILogger> logger
private static readonly ResourceManager _resourceManagerLogMessages = new("GenAIDBExplorer.Console.Resources.LogMessages", typeof(InitProjectCommandHandler).Assembly);
///
- /// Sets up the init-project command.
+ /// Sets up the init-project command using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The init-project command.
@@ -44,17 +44,18 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var initCommand = new Command("init-project", "Initialize a GenAI Database Explorer project.");
- initCommand.AddOption(projectPathOption);
- initCommand.SetHandler(async (DirectoryInfo projectPath) =>
+ initCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+ initCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
var handler = host.Services.GetRequiredService();
var options = new InitProjectCommandHandlerOptions(projectPath);
await handler.HandleAsync(options);
- }, projectPathOption);
+ });
return initCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/QueryModelCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/QueryModelCommandHandler.cs
index 8762ac0..56aee70 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/QueryModelCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/QueryModelCommandHandler.cs
@@ -35,7 +35,7 @@ ILogger> logger
private static readonly ResourceManager _resourceManagerLogMessages = new("GenAIDBExplorer.Console.Resources.LogMessages", typeof(QueryModelCommandHandler).Assembly);
///
- /// Sets up the query command.
+ /// Sets up the query command using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The query command.
@@ -46,17 +46,18 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var queryCommand = new Command("query-model", "Answer questions based on the semantic model by using Generative AI.");
- queryCommand.AddOption(projectPathOption);
- queryCommand.SetHandler(async (DirectoryInfo projectPath) =>
+ queryCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+ queryCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
var handler = host.Services.GetRequiredService();
var options = new QueryModelCommandHandlerOptions(projectPath);
await handler.HandleAsync(options);
- }, projectPathOption);
+ });
return queryCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ShowObjectCommandHandler.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ShowObjectCommandHandler.cs
index 91c655e..c4d2061 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ShowObjectCommandHandler.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/CommandHandlers/ShowObjectCommandHandler.cs
@@ -31,7 +31,7 @@ ILogger> logger
private static readonly ResourceManager _resourceManagerErrorMessages = new("GenAIDBExplorer.Console.Resources.ErrorMessages", typeof(ShowObjectCommandHandler).Assembly);
///
- /// Sets up the show command and its subcommands.
+ /// Sets up the show command and its subcommands using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The host instance.
/// The show command.
@@ -42,7 +42,7 @@ public static Command SetupCommand(IHost host)
description: "The path to the GenAI Database Explorer project."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var schemaNameOption = new Option(
@@ -50,7 +50,7 @@ public static Command SetupCommand(IHost host)
description: "The schema name of the object to show."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
var nameOption = new Option(
@@ -58,56 +58,65 @@ public static Command SetupCommand(IHost host)
description: "The name of the object to show."
)
{
- IsRequired = true
+ Required = true // Updated from IsRequired for beta5 compatibility
};
// Create the base 'show' command
var showCommand = new Command("show-object", "Show details of a semantic model object.");
// Create subcommands
- var tableCommand = new Command("table", "Show details of a table.")
- {
- projectPathOption,
- schemaNameOption,
- nameOption
- };
- tableCommand.SetHandler(async (DirectoryInfo projectPath, string schemaName, string name) =>
+ var tableCommand = new Command("table", "Show details of a table.");
+ tableCommand.Options.Add(projectPathOption); // Updated from AddOption for beta5 compatibility
+ tableCommand.Options.Add(schemaNameOption);
+ tableCommand.Options.Add(nameOption);
+
+ tableCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+
var handler = host.Services.GetRequiredService();
var options = new ShowObjectCommandHandlerOptions(projectPath, schemaName, name, "table");
await handler.HandleAsync(options);
- }, projectPathOption, schemaNameOption, nameOption);
+ });
- var viewCommand = new Command("view", "Show details of a view.")
- {
- projectPathOption,
- schemaNameOption,
- nameOption
- };
- viewCommand.SetHandler(async (DirectoryInfo projectPath, string schemaName, string name) =>
+ var viewCommand = new Command("view", "Show details of a view.");
+ viewCommand.Options.Add(projectPathOption);
+ viewCommand.Options.Add(schemaNameOption);
+ viewCommand.Options.Add(nameOption);
+
+ viewCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+
var handler = host.Services.GetRequiredService();
var options = new ShowObjectCommandHandlerOptions(projectPath, schemaName, name, "view");
await handler.HandleAsync(options);
- }, projectPathOption, schemaNameOption, nameOption);
+ });
- var storedProcedureCommand = new Command("storedprocedure", "Show details of a stored procedure.")
- {
- projectPathOption,
- schemaNameOption,
- nameOption
- };
- storedProcedureCommand.SetHandler(async (DirectoryInfo projectPath, string schemaName, string name) =>
+ var storedProcedureCommand = new Command("storedprocedure", "Show details of a stored procedure.");
+ storedProcedureCommand.Options.Add(projectPathOption);
+ storedProcedureCommand.Options.Add(schemaNameOption);
+ storedProcedureCommand.Options.Add(nameOption);
+
+ storedProcedureCommand.SetAction(async (ParseResult parseResult) => // Updated from SetHandler for beta5 compatibility
{
+ var projectPath = parseResult.GetValue(projectPathOption);
+ var schemaName = parseResult.GetValue(schemaNameOption);
+ var name = parseResult.GetValue(nameOption);
+
var handler = host.Services.GetRequiredService();
var options = new ShowObjectCommandHandlerOptions(projectPath, schemaName, name, "storedprocedure");
await handler.HandleAsync(options);
- }, projectPathOption, schemaNameOption, nameOption);
+ });
- // Add subcommands to the 'show' command
- showCommand.AddCommand(tableCommand);
- showCommand.AddCommand(viewCommand);
- showCommand.AddCommand(storedProcedureCommand);
+ // Add subcommands to the 'show' command using beta5 mutable collections API
+ showCommand.Subcommands.Add(tableCommand); // Updated from AddCommand for beta5 compatibility
+ showCommand.Subcommands.Add(viewCommand);
+ showCommand.Subcommands.Add(storedProcedureCommand);
return showCommand;
}
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/GenAIDBExplorer.Console.csproj b/src/GenAIDBExplorer/GenAIDBExplorer.Console/GenAIDBExplorer.Console.csproj
index a9039c8..bec0bf9 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/GenAIDBExplorer.Console.csproj
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/GenAIDBExplorer.Console.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/GenAIDBExplorer/GenAIDBExplorer.Console/Program.cs b/src/GenAIDBExplorer/GenAIDBExplorer.Console/Program.cs
index 1345f88..ac2c118 100644
--- a/src/GenAIDBExplorer/GenAIDBExplorer.Console/Program.cs
+++ b/src/GenAIDBExplorer/GenAIDBExplorer.Console/Program.cs
@@ -11,7 +11,7 @@ namespace GenAIDBExplorer.Console;
internal static class Program
{
///
- /// The main method that sets up and runs the application.
+ /// The main method that sets up and runs the application using System.CommandLine 2.0.0-beta5 API patterns.
///
/// The command-line arguments.
private static async Task Main(string[] args)
@@ -24,14 +24,14 @@ private static async Task Main(string[] args)
.ConfigureHost(args)
.Build();
- // Set up commands
- rootCommand.AddCommand(InitProjectCommandHandler.SetupCommand(host));
- rootCommand.AddCommand(DataDictionaryCommandHandler.SetupCommand(host));
- rootCommand.AddCommand(EnrichModelCommandHandler.SetupCommand(host));
- rootCommand.AddCommand(ExportModelCommandHandler.SetupCommand(host));
- rootCommand.AddCommand(ExtractModelCommandHandler.SetupCommand(host));
- rootCommand.AddCommand(QueryModelCommandHandler.SetupCommand(host));
- rootCommand.AddCommand(ShowObjectCommandHandler.SetupCommand(host));
+ // Set up commands using new beta5 mutable collections API
+ rootCommand.Subcommands.Add(InitProjectCommandHandler.SetupCommand(host)); // Updated from AddCommand for beta5 compatibility
+ rootCommand.Subcommands.Add(DataDictionaryCommandHandler.SetupCommand(host));
+ rootCommand.Subcommands.Add(EnrichModelCommandHandler.SetupCommand(host));
+ rootCommand.Subcommands.Add(ExportModelCommandHandler.SetupCommand(host));
+ rootCommand.Subcommands.Add(ExtractModelCommandHandler.SetupCommand(host));
+ rootCommand.Subcommands.Add(QueryModelCommandHandler.SetupCommand(host));
+ rootCommand.Subcommands.Add(ShowObjectCommandHandler.SetupCommand(host));
// Invoke the root command
await rootCommand.InvokeAsync(args);