Class ProtoOptionsRegistration
Registers a single instance of an options type and applies every configuration callback in registration order before binding the type's known configuration section over the result, so repeated registration composes instead of replacing earlier callbacks.
public static class ProtoOptionsRegistration
- Inheritance
-
ProtoOptionsRegistration
- Inherited Members
Methods
ConfigureKeyed<TOptions>(IServiceCollection, string, Func<TOptions>, Action<TOptions>?, bool)
Registers one keyed instance of TOptions under key:
every call's configure callback runs in registration order, then the section
named by ConfigurationSectionName binds over the result.
This is the per-named-client shape; with registerDefault, the unkeyed
instance a transport-backed fallback client reads is registered too, with the same factory and
section binding but no keyed callback.
public static void ConfigureKeyed<TOptions>(IServiceCollection services, string key, Func<TOptions> factory, Action<TOptions>? configure = null, bool registerDefault = false) where TOptions : class, IProtoConfigurableOptions
Parameters
servicesIServiceCollectionkeystringfactoryFunc<TOptions>configureAction<TOptions>registerDefaultbool
Type Parameters
TOptions
Configure<TOptions>(IServiceCollection, Func<TOptions>, Action<TOptions>?)
Registers TOptions once in services. Every call's
configure callback runs in registration order, then the section named by
ConfigurationSectionName binds over the result.
public static void Configure<TOptions>(IServiceCollection services, Func<TOptions> factory, Action<TOptions>? configure = null) where TOptions : class, IProtoConfigurableOptions
Parameters
servicesIServiceCollectionfactoryFunc<TOptions>configureAction<TOptions>
Type Parameters
TOptions
Resolve<TOptions>(IServiceProvider, Action<TOptions>?)
The Resolve<TOptions>(IServiceProvider, Func<TOptions>, Action<TOptions>?) form for an options type with a parameterless constructor.
public static TOptions Resolve<TOptions>(IServiceProvider services, Action<TOptions>? configure = null) where TOptions : class, IProtoConfigurableOptions, new()
Parameters
servicesIServiceProviderconfigureAction<TOptions>
Returns
- TOptions
Type Parameters
TOptions
Resolve<TOptions>(IServiceProvider, Func<TOptions>, Action<TOptions>?)
Builds an options instance for a service provider: the factory runs, then the code callback, and the type's known configuration section binds over the result - configuration wins over code.
public static TOptions Resolve<TOptions>(IServiceProvider services, Func<TOptions> factory, Action<TOptions>? configure = null) where TOptions : class, IProtoConfigurableOptions
Parameters
servicesIServiceProviderfactoryFunc<TOptions>configureAction<TOptions>
Returns
- TOptions
Type Parameters
TOptions