SavvyioDependencyInjectionOptions Class
Definition
- Namespace
- Savvyio.Extensions.DependencyInjection
- Assemblies
- Savvyio.Extensions.DependencyInjection.dll
Specifies options that is related to setting up Savvy I/O services.
public class SavvyioDependencyInjectionOptions : SavvyioOptions, IParameterObject
- Inheritance
-
objectSavvyioDependencyInjectionOptions
- Implements
- Inherited Members
- Extension Methods
Examples
Configure a SavvyioDependencyInjectionOptions instance to control assembly scanning, handler and dispatcher discovery, and DI service lifetimes.
using Microsoft.Extensions.DependencyInjection;
using Savvyio;
using Savvyio.Extensions.DependencyInjection;
namespace ExampleApp;
public static class DependencyInjectionSetup
{
public static IServiceCollection AddApplicationMessaging(this IServiceCollection services)
{
services.AddSavvyIO(ConfigureOptions);
services.AddHandlerServicesDescriptor();
return services;
}
private static void ConfigureOptions(SavvyioDependencyInjectionOptions options)
{
options.AddAssemblyRangeToScan(typeof(SavvyioOptions).Assembly, typeof(DependencyInjectionSetup).Assembly);
options.EnableDispatcherDiscovery();
options.EnableHandlerDiscovery();
options.EnableHandlerServicesDescriptor();
options.ServiceLocatorLifetime = ServiceLifetime.Singleton;
options.HandlerServicesLifetime = ServiceLifetime.Scoped;
options.DispatcherServicesLifetime = ServiceLifetime.Singleton;
}
}
Constructors
| Name | Description |
|---|---|
| SavvyioDependencyInjectionOptions() | Initializes a new instance of the SavvyioDependencyInjectionOptions class. |
Properties
| Name | Description |
|---|---|
| AssembliesToScan | Gets the assemblies to scan for dispatcher- and handler- types. |
| DispatcherServicesLifetime | Gets or sets the lifetime of the dispatcher services. |
| HandlerServicesLifetime | Gets or sets the lifetime of the handler services. |
| ServiceLocatorImplementationFactory | Gets or sets the function delegate that creates an instance of an IServiceLocator implementation. |
| ServiceLocatorLifetime | Gets or sets the lifetime of the IServiceLocator. |
Methods
| Name | Description |
|---|---|
| AddAssemblyRangeToScan(params Assembly[]) | Adds the specified range of |
| AddAssemblyToScan(Assembly) | Adds the specified |