Class ServiceCollectionExtensions
- Namespace
- Codebelt.Extensions.BenchmarkDotNet
- Assembly
- Codebelt.Extensions.BenchmarkDotNet.dll
Extension methods for the IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ServiceCollectionExtensions
Methods
AddBenchmarkWorkspace(IServiceCollection, Action<BenchmarkWorkspaceOptions>)
Adds the default benchmark workspace implementation (BenchmarkWorkspace) to the specified IServiceCollection
public static IServiceCollection AddBenchmarkWorkspace(this IServiceCollection services, Action<BenchmarkWorkspaceOptions> setup = null)
Parameters
servicesIServiceCollectionThe IServiceCollection to add the services to.
setupAction<BenchmarkWorkspaceOptions>The BenchmarkWorkspaceOptions which may be configured.
Returns
- IServiceCollection
The original IServiceCollection instance for chaining.
AddBenchmarkWorkspace<TWorkspace>(IServiceCollection, Action<BenchmarkWorkspaceOptions>)
Adds a benchmark workspace implementation of type TWorkspace to the specified IServiceCollection
public static IServiceCollection AddBenchmarkWorkspace<TWorkspace>(this IServiceCollection services, Action<BenchmarkWorkspaceOptions> setup = null) where TWorkspace : class, IBenchmarkWorkspace
Parameters
servicesIServiceCollectionThe IServiceCollection to add the services to.
setupAction<BenchmarkWorkspaceOptions>The BenchmarkWorkspaceOptions which may be configured.
Returns
- IServiceCollection
The original IServiceCollection instance for chaining.
Type Parameters
TWorkspaceThe type that implements the IBenchmarkWorkspace interface.
Remarks
Validates the services parameter and the provided setup configurator.
Registers IBenchmarkWorkspace as a singleton using TWorkspace,
applies the provided configuration, and registers the resolved BenchmarkWorkspaceOptions as a singleton.