CreateWebApplicationOptionsExtensions
NexusLabs.Needlr.AspNet¶
CreateWebApplicationOptionsExtensions Class¶
Provides extension methods for configuring CreateWebApplicationOptions.
Inheritance System.Object 🡒 CreateWebApplicationOptionsExtensions
Methods¶
CreateWebApplicationOptionsExtensions.UsingApplicationName(this CreateWebApplicationOptions, string) Method¶
Configures the options to use the specified application name.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingApplicationName(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, string applicationName);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
applicationName System.String
The application name to use.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the application name configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or applicationName is null.
CreateWebApplicationOptionsExtensions.UsingCliArgs(this CreateWebApplicationOptions, string[]) Method¶
Configures the options to use the specified command line arguments.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingCliArgs(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, string[] args);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
args System.String[]
The command line arguments to use.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the command line arguments configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or args is null.
CreateWebApplicationOptionsExtensions.UsingCurrentProcessCliArgs(this CreateWebApplicationOptions) Method¶
Configures the options to use the current process's command line arguments, automatically stripping the executable path that appears at index 0 of System.Environment.GetCommandLineArgs.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingCurrentProcessCliArgs(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the current process's command line arguments.
Exceptions¶
System.ArgumentNullException
Thrown when options is null.
Example¶
var webApp = new Syringe()
.ForWebApplication()
.UsingOptions(() => CreateWebApplicationOptions.Default
.UsingCurrentProcessCliArgs())
.BuildWebApplication();
CreateWebApplicationOptionsExtensions.UsingLogger(this CreateWebApplicationOptions, ILogger) Method¶
Configures the options to use the specified logger for startup diagnostics. Use this when you already have an Microsoft.Extensions.Logging.ILogger instance and want to pass it directly instead of having Needlr create a console logger internally.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingLogger(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, Microsoft.Extensions.Logging.ILogger logger);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
logger Microsoft.Extensions.Logging.ILogger
The logger to use during startup.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the logger configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or logger is null.
Example¶
var webApp = new Syringe()
.ForWebApplication()
.UsingOptions(() => CreateWebApplicationOptions.Default
.UsingLogger(myLogger))
.BuildWebApplication();
CreateWebApplicationOptionsExtensions.UsingPostPluginRegistrationCallback(this CreateWebApplicationOptions, Action<IServiceCollection>) Method¶
Adds a post-plugin registration callback to the options.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingPostPluginRegistrationCallback(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> callback);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
callback System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>
The callback to add for post-plugin registration.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the callback added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callback is null.
CreateWebApplicationOptionsExtensions.UsingPostPluginRegistrationCallbacks(this CreateWebApplicationOptions, Action<IServiceCollection>[]) Method¶
Adds multiple post-plugin registration callbacks to the options.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingPostPluginRegistrationCallbacks(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, params System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[] callbacks);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
callbacks System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[]
The callbacks to add for post-plugin registration.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateWebApplicationOptionsExtensions.UsingPostPluginRegistrationCallbacks(this CreateWebApplicationOptions, IEnumerable<Action<IServiceCollection>>) Method¶
Adds multiple post-plugin registration callbacks to the options.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingPostPluginRegistrationCallbacks(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>> callbacks);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
callbacks System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>>
The callbacks to add for post-plugin registration.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateWebApplicationOptionsExtensions.UsingPrePluginRegistrationCallback(this CreateWebApplicationOptions, Action<IServiceCollection>) Method¶
Adds a pre-plugin registration callback to the options.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingPrePluginRegistrationCallback(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> callback);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
callback System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>
The callback to add for pre-plugin registration.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the callback added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callback is null.
CreateWebApplicationOptionsExtensions.UsingPrePluginRegistrationCallbacks(this CreateWebApplicationOptions, Action<IServiceCollection>[]) Method¶
Adds multiple pre-plugin registration callbacks to the options.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingPrePluginRegistrationCallbacks(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, params System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[] callbacks);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
callbacks System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[]
The callbacks to add for pre-plugin registration.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateWebApplicationOptionsExtensions.UsingPrePluginRegistrationCallbacks(this CreateWebApplicationOptions, IEnumerable<Action<IServiceCollection>>) Method¶
Adds multiple pre-plugin registration callbacks to the options.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingPrePluginRegistrationCallbacks(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>> callbacks);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
callbacks System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>>
The callbacks to add for pre-plugin registration.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateWebApplicationOptionsExtensions.UsingStartupConsoleLogger(this CreateWebApplicationOptions, string, LogLevel) Method¶
Configures the options to use a console logger for startup logging.
public static NexusLabs.Needlr.AspNet.CreateWebApplicationOptions UsingStartupConsoleLogger(this NexusLabs.Needlr.AspNet.CreateWebApplicationOptions options, string name="Startup", Microsoft.Extensions.Logging.LogLevel level=Microsoft.Extensions.Logging.LogLevel.Debug);
Parameters¶
options CreateWebApplicationOptions
The options to configure.
name System.String
The name of the logger. Defaults to "Startup".
level Microsoft.Extensions.Logging.LogLevel
The minimum log level. Defaults to Microsoft.Extensions.Logging.LogLevel.Debug.
Returns¶
CreateWebApplicationOptions
A new instance of CreateWebApplicationOptions with the console logger configured.
Exceptions¶
System.ArgumentNullException
Thrown when options is null.
System.ArgumentException
Thrown when name is null or whitespace.