CreateHostOptionsExtensions
NexusLabs.Needlr.Hosting¶
CreateHostOptionsExtensions Class¶
Provides extension methods for configuring CreateHostOptions.
Inheritance System.Object 🡒 CreateHostOptionsExtensions
Methods¶
CreateHostOptionsExtensions.UsingApplicationName(this CreateHostOptions, string) Method¶
Configures the options to use the specified application name.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingApplicationName(this NexusLabs.Needlr.Hosting.CreateHostOptions options, string applicationName);
Parameters¶
options CreateHostOptions
The options to configure.
applicationName System.String
The application name to use.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the application name configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or applicationName is null.
CreateHostOptionsExtensions.UsingArgs(this CreateHostOptions, string[]) Method¶
Configures the options to use the specified command line arguments.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingArgs(this NexusLabs.Needlr.Hosting.CreateHostOptions options, string[] args);
Parameters¶
options CreateHostOptions
The options to configure.
args System.String[]
The command line arguments to use.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the command line arguments configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or args is null.
CreateHostOptionsExtensions.UsingContentRootPath(this CreateHostOptions, string) Method¶
Configures the options to use the specified content root path.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingContentRootPath(this NexusLabs.Needlr.Hosting.CreateHostOptions options, string contentRootPath);
Parameters¶
options CreateHostOptions
The options to configure.
contentRootPath System.String
The content root path to use.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the content root path configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or contentRootPath is null.
CreateHostOptionsExtensions.UsingCurrentProcessArgs(this CreateHostOptions) 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.Hosting.CreateHostOptions UsingCurrentProcessArgs(this NexusLabs.Needlr.Hosting.CreateHostOptions options);
Parameters¶
options CreateHostOptions
The options to configure.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the current process's command line arguments.
Exceptions¶
System.ArgumentNullException
Thrown when options is null.
Example¶
var host = new Syringe()
.ForHost()
.UsingOptions(() => CreateHostOptions.Default
.UsingCurrentProcessArgs())
.BuildHost();
CreateHostOptionsExtensions.UsingEnvironmentName(this CreateHostOptions, string) Method¶
Configures the options to use the specified environment name.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingEnvironmentName(this NexusLabs.Needlr.Hosting.CreateHostOptions options, string environmentName);
Parameters¶
options CreateHostOptions
The options to configure.
environmentName System.String
The environment name to use.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the environment name configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or environmentName is null.
CreateHostOptionsExtensions.UsingLogger(this CreateHostOptions, 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.Hosting.CreateHostOptions UsingLogger(this NexusLabs.Needlr.Hosting.CreateHostOptions options, Microsoft.Extensions.Logging.ILogger logger);
Parameters¶
options CreateHostOptions
The options to configure.
logger Microsoft.Extensions.Logging.ILogger
The logger to use during startup.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the logger configured.
Exceptions¶
System.ArgumentNullException
Thrown when options or logger is null.
Example¶
var host = new Syringe()
.ForHost()
.UsingOptions(() => CreateHostOptions.Default
.UsingLogger(myLogger))
.BuildHost();
CreateHostOptionsExtensions.UsingPostPluginRegistrationCallback(this CreateHostOptions, Action<IServiceCollection>) Method¶
Adds a post-plugin registration callback to the options.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingPostPluginRegistrationCallback(this NexusLabs.Needlr.Hosting.CreateHostOptions options, System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> callback);
Parameters¶
options CreateHostOptions
The options to configure.
callback System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>
The callback to add for post-plugin registration.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the callback added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callback is null.
CreateHostOptionsExtensions.UsingPostPluginRegistrationCallbacks(this CreateHostOptions, Action<IServiceCollection>[]) Method¶
Adds multiple post-plugin registration callbacks to the options.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingPostPluginRegistrationCallbacks(this NexusLabs.Needlr.Hosting.CreateHostOptions options, params System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[] callbacks);
Parameters¶
options CreateHostOptions
The options to configure.
callbacks System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[]
The callbacks to add for post-plugin registration.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateHostOptionsExtensions.UsingPostPluginRegistrationCallbacks(this CreateHostOptions, IEnumerable<Action<IServiceCollection>>) Method¶
Adds multiple post-plugin registration callbacks to the options.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingPostPluginRegistrationCallbacks(this NexusLabs.Needlr.Hosting.CreateHostOptions options, System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>> callbacks);
Parameters¶
options CreateHostOptions
The options to configure.
callbacks System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>>
The callbacks to add for post-plugin registration.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateHostOptionsExtensions.UsingPrePluginRegistrationCallback(this CreateHostOptions, Action<IServiceCollection>) Method¶
Adds a pre-plugin registration callback to the options.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingPrePluginRegistrationCallback(this NexusLabs.Needlr.Hosting.CreateHostOptions options, System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> callback);
Parameters¶
options CreateHostOptions
The options to configure.
callback System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>
The callback to add for pre-plugin registration.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the callback added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callback is null.
CreateHostOptionsExtensions.UsingPrePluginRegistrationCallbacks(this CreateHostOptions, Action<IServiceCollection>[]) Method¶
Adds multiple pre-plugin registration callbacks to the options.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingPrePluginRegistrationCallbacks(this NexusLabs.Needlr.Hosting.CreateHostOptions options, params System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[] callbacks);
Parameters¶
options CreateHostOptions
The options to configure.
callbacks System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>[]
The callbacks to add for pre-plugin registration.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateHostOptionsExtensions.UsingPrePluginRegistrationCallbacks(this CreateHostOptions, IEnumerable<Action<IServiceCollection>>) Method¶
Adds multiple pre-plugin registration callbacks to the options.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingPrePluginRegistrationCallbacks(this NexusLabs.Needlr.Hosting.CreateHostOptions options, System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>> callbacks);
Parameters¶
options CreateHostOptions
The options to configure.
callbacks System.Collections.Generic.IEnumerable<System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection>>
The callbacks to add for pre-plugin registration.
Returns¶
CreateHostOptions
A new instance of CreateHostOptions with the callbacks added.
Exceptions¶
System.ArgumentNullException
Thrown when options or callbacks is null.
CreateHostOptionsExtensions.UsingStartupConsoleLogger(this CreateHostOptions, string, LogLevel) Method¶
Configures the options to use a console logger for startup logging.
public static NexusLabs.Needlr.Hosting.CreateHostOptions UsingStartupConsoleLogger(this NexusLabs.Needlr.Hosting.CreateHostOptions options, string name="Startup", Microsoft.Extensions.Logging.LogLevel level=Microsoft.Extensions.Logging.LogLevel.Debug);
Parameters¶
options CreateHostOptions
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¶
CreateHostOptions
A new instance of CreateHostOptions with the console logger configured.
Exceptions¶
System.ArgumentNullException
Thrown when options is null.
System.ArgumentException
Thrown when name is null or whitespace.