@@ -104,12 +104,12 @@ protected override void RegisterOptions(Command command)
104104 command . Validators . Add ( commandResult =>
105105 {
106106 string transport = ResolveTransport ( commandResult ) ;
107- bool httpIncomingAuthDisabled = commandResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth ) ;
107+ bool httpIncomingAuthDisabled = commandResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth ) ;
108108 ValidateMode ( commandResult . GetValueOrDefault ( ServiceOptionDefinitions . Mode ) , commandResult ) ;
109109 ValidateTransportConfiguration ( transport , httpIncomingAuthDisabled , commandResult ) ;
110110 ValidateNamespaceAndToolMutualExclusion (
111- commandResult . GetValueOrDefault < string [ ] ? > ( ServiceOptionDefinitions . Namespace . Name ) ,
112- commandResult . GetValueOrDefault < string [ ] ? > ( ServiceOptionDefinitions . Tool . Name ) ,
111+ commandResult . GetValueOrDefault ( ServiceOptionDefinitions . Namespace ) ,
112+ commandResult . GetValueOrDefault ( ServiceOptionDefinitions . Tool ) ,
113113 commandResult ) ;
114114 ValidateOutgoingAuthStrategy ( commandResult ) ;
115115 ValidateSupportLoggingFolder ( commandResult ) ;
@@ -122,7 +122,7 @@ protected override void RegisterOptions(Command command)
122122 /// <param name="commandResult">Command result to update on failure.</param>
123123 private static void ValidateSupportLoggingFolder ( CommandResult commandResult )
124124 {
125- string ? folderPath = commandResult . GetValueOrDefault < string ? > ( ServiceOptionDefinitions . DangerouslyWriteSupportLogsToDir . Name ) ;
125+ string ? folderPath = commandResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyWriteSupportLogsToDir ) ;
126126
127127 if ( folderPath is null )
128128 {
@@ -155,8 +155,8 @@ private static void ValidateSupportLoggingFolder(CommandResult commandResult)
155155 /// <returns>A configured ServiceStartOptions instance.</returns>
156156 protected override ServiceStartOptions BindOptions ( ParseResult parseResult )
157157 {
158- var mode = parseResult . GetValueOrDefault < string ? > ( ServiceOptionDefinitions . Mode . Name ) ;
159- var tools = parseResult . GetValueOrDefault < string [ ] ? > ( ServiceOptionDefinitions . Tool . Name ) ;
158+ var mode = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . Mode ) ;
159+ var tools = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . Tool ) ;
160160
161161 // When --tool switch is used, automatically change the mode to "all"
162162 if ( tools != null && tools . Length > 0 )
@@ -169,18 +169,18 @@ protected override ServiceStartOptions BindOptions(ParseResult parseResult)
169169 var options = new ServiceStartOptions
170170 {
171171 Transport = ResolveTransport ( parseResult ) ,
172- Namespace = parseResult . GetValueOrDefault < string [ ] ? > ( ServiceOptionDefinitions . Namespace . Name ) ,
172+ Namespace = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . Namespace ) ,
173173 Mode = mode ,
174174 Tool = tools ,
175- ReadOnly = parseResult . GetValueOrDefault < bool ? > ( ServiceOptionDefinitions . ReadOnly . Name ) ,
176- Debug = parseResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . Debug . Name ) ,
177- DangerouslyDisableHttpIncomingAuth = parseResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth . Name ) ,
178- DangerouslyDisableElicitation = parseResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DangerouslyDisableElicitation . Name ) ,
175+ ReadOnly = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . ReadOnly ) ,
176+ Debug = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . Debug ) ,
177+ DangerouslyDisableHttpIncomingAuth = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth ) ,
178+ DangerouslyDisableElicitation = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyDisableElicitation ) ,
179179 OutgoingAuthStrategy = outgoingAuthStrategy ,
180- SupportLoggingFolder = parseResult . GetValueOrDefault < string ? > ( ServiceOptionDefinitions . DangerouslyWriteSupportLogsToDir . Name ) ,
181- DangerouslyDisableRetryLimits = parseResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DangerouslyDisableRetryLimits . Name ) ,
182- Cloud = parseResult . GetValueOrDefault < string ? > ( ServiceOptionDefinitions . Cloud . Name ) ,
183- DisableCaching = parseResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DisableCaching . Name )
180+ SupportLoggingFolder = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyWriteSupportLogsToDir ) ,
181+ DangerouslyDisableRetryLimits = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyDisableRetryLimits ) ,
182+ Cloud = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . Cloud ) ,
183+ DisableCaching = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . DisableCaching )
184184 } ;
185185 return options ;
186186 }
@@ -341,12 +341,12 @@ private static void ValidateNamespaceAndToolMutualExclusion(string[]? namespaces
341341 /// <param name="commandResult">Command result to update on failure.</param>
342342 private static void ValidateOutgoingAuthStrategy ( CommandResult commandResult )
343343 {
344- var outgoingAuthStrategy = commandResult . GetValueOrDefault < OutgoingAuthStrategy > ( ServiceOptionDefinitions . OutgoingAuthStrategy . Name ) ;
344+ var outgoingAuthStrategy = commandResult . GetValueOrDefault ( ServiceOptionDefinitions . OutgoingAuthStrategy ) ;
345345 if ( outgoingAuthStrategy == OutgoingAuthStrategy . UseOnBehalfOf )
346346 {
347347#if ENABLE_HTTP
348348 string transport = ResolveTransport ( commandResult ) ;
349- bool httpIncomingAuthDisabled = commandResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth ) ;
349+ bool httpIncomingAuthDisabled = commandResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth ) ;
350350
351351 if ( transport != TransportTypes . Http || httpIncomingAuthDisabled )
352352 {
@@ -875,13 +875,13 @@ private static void InitializeListingUrls(WebApplicationBuilder builder, Service
875875 private static OutgoingAuthStrategy ResolveAuthStrategy ( ParseResult parseResult )
876876 {
877877#if ENABLE_HTTP
878- var outgoingAuthStrategy = parseResult . GetValueOrDefault < OutgoingAuthStrategy > ( ServiceOptionDefinitions . OutgoingAuthStrategy . Name ) ;
878+ var outgoingAuthStrategy = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . OutgoingAuthStrategy ) ;
879879 if ( outgoingAuthStrategy == OutgoingAuthStrategy . NotSet )
880880 {
881881 string transport = ResolveTransport ( parseResult ) ;
882882 if ( transport == TransportTypes . Http )
883883 {
884- bool httpIncomingAuthDisabled = parseResult . GetValueOrDefault < bool > ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth . Name ) ;
884+ bool httpIncomingAuthDisabled = parseResult . GetValueOrDefault ( ServiceOptionDefinitions . DangerouslyDisableHttpIncomingAuth ) ;
885885 return httpIncomingAuthDisabled
886886 ? OutgoingAuthStrategy . UseHostingEnvironmentIdentity
887887 : OutgoingAuthStrategy . UseOnBehalfOf ;
@@ -903,19 +903,15 @@ private static OutgoingAuthStrategy ResolveAuthStrategy(ParseResult parseResult)
903903 /// <param name="parseResult">The parsed command line arguments.</param>
904904 /// <returns>The transport type string (stdio or http).</returns>
905905 private static string ResolveTransport ( ParseResult parseResult )
906- {
907- return parseResult . GetValueOrDefault < string > ( ServiceOptionDefinitions . Transport . Name ) ?? TransportTypes . StdIo ;
908- }
906+ => parseResult . GetValueOrDefault ( ServiceOptionDefinitions . Transport ) ?? TransportTypes . StdIo ;
909907
910908 /// <summary>
911909 /// Resolves the transport type from command result, defaulting to STDIO if not specified.
912910 /// </summary>
913911 /// <param name="commandResult">The command result to extract transport from.</param>
914912 /// <returns>The transport type string (stdio or http).</returns>
915913 private static string ResolveTransport ( CommandResult commandResult )
916- {
917- return commandResult . GetValueOrDefault < string > ( ServiceOptionDefinitions . Transport . Name ) ?? TransportTypes . StdIo ;
918- }
914+ => commandResult . GetValueOrDefault ( ServiceOptionDefinitions . Transport ) ?? TransportTypes . StdIo ;
919915
920916 private static WebApplication UseHttpsRedirectionIfEnabled ( WebApplication app )
921917 {
0 commit comments