Method AddIntentSharp
- Namespace
- IntentSharp.DependencyInjection
- Assembly
- IntentSharp.dll
AddIntentSharp(IServiceCollection, IConfiguration, string)
Registers a singleton IntentClient configured from the "IntentSharp" configuration section,
and builds it when the application starts. Under a .NET host (ASP.NET Core, a worker service, the generic host)
IHost.StartAsync runs the options startup validation (IStartupValidator) before it starts
hosted services or serves a request; that validation builds the client, so the license key is checked then,
exactly as Build() checks it. A LicenseException
(a paid key whose maintenance ended before this release, or Options:FailWhenUnlicensed) and any other
configuration error stop the host, unwrapped,
and the build-time license notice is logged at startup. Without a host, call
GetRequiredService<IStartupValidator>().Validate() (or resolve the client) during startup for the
same behaviour. The license is checked before memory, cache or rate limiter are created.
public static IServiceCollection AddIntentSharp(this IServiceCollection services, IConfiguration configuration, string sectionName = "IntentSharp")
Parameters
servicesIServiceCollectionconfigurationIConfigurationsectionNamestring
Returns
- IServiceCollection
AddIntentSharp(IServiceCollection, Action<IntentSharpSettings>)
Registers a singleton IntentClient configured in code. Startup and license behaviour are the same as the configuration overload.
public static IServiceCollection AddIntentSharp(this IServiceCollection services, Action<IntentSharpSettings> configure)
Parameters
servicesIServiceCollectionconfigureAction<IntentSharpSettings>
Returns
- IServiceCollection