Class SilverbackBuilderAddBehaviorExtensions
Adds the AddTransientBehavior, AddScopedBehavior and AddSingletonBehavior methods
to the ISilverbackBuilder.
Inherited Members
Namespace: Microsoft.Extensions.DependencyInjection
Assembly: Silverback.Core.dll
Syntax
public static class SilverbackBuilderAddBehaviorExtensions
Methods
| Improve this doc View sourceAddScopedBehavior(ISilverbackBuilder, Func<IServiceProvider, IBehavior>)
Adds a scoped behavior with a factory specified in implementationFactory to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddScopedBehavior(this ISilverbackBuilder silverbackBuilder, Func<IServiceProvider, IBehavior> implementationFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| Func<IServiceProvider, IBehavior> | implementationFactory | The factory that creates the service. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddScopedBehavior(ISilverbackBuilder, Type)
Adds a scoped behavior of the type specified in behaviorType to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddScopedBehavior(this ISilverbackBuilder silverbackBuilder, Type behaviorType)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| Type | behaviorType | The type of the behavior to register and the implementation to use. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddScopedBehavior<TBehavior>(ISilverbackBuilder)
Adds a scoped behavior of the type specified in TBehavior to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddScopedBehavior<TBehavior>(this ISilverbackBuilder silverbackBuilder) where TBehavior : class, IBehavior
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TBehavior | The type of the behavior to add. |
AddSingletonBehavior(ISilverbackBuilder, IBehavior)
Adds a singleton behavior with an instance specified in implementationInstance
to the IServiceCollection.
Declaration
public static ISilverbackBuilder AddSingletonBehavior(this ISilverbackBuilder silverbackBuilder, IBehavior implementationInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| IBehavior | implementationInstance | The instance of the service. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddSingletonBehavior(ISilverbackBuilder, Func<IServiceProvider, IBehavior>)
Adds a singleton behavior with a factory specified in implementationFactory to
the IServiceCollection.
Declaration
public static ISilverbackBuilder AddSingletonBehavior(this ISilverbackBuilder silverbackBuilder, Func<IServiceProvider, IBehavior> implementationFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| Func<IServiceProvider, IBehavior> | implementationFactory | The factory that creates the service. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddSingletonBehavior(ISilverbackBuilder, Type)
Adds a singleton behavior of the type specified in behaviorType to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddSingletonBehavior(this ISilverbackBuilder silverbackBuilder, Type behaviorType)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| Type | behaviorType | The type of the behavior to register and the implementation to use. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddSingletonBehavior<TBehavior>(ISilverbackBuilder)
Adds a singleton behavior of the type specified in TBehavior to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddSingletonBehavior<TBehavior>(this ISilverbackBuilder silverbackBuilder) where TBehavior : class, IBehavior
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TBehavior | The type of the behavior to add. |
AddTransientBehavior(ISilverbackBuilder, Func<IServiceProvider, IBehavior>)
Adds a scoped behavior with a factory specified in implementationFactory to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddTransientBehavior(this ISilverbackBuilder silverbackBuilder, Func<IServiceProvider, IBehavior> implementationFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| Func<IServiceProvider, IBehavior> | implementationFactory | The factory that creates the service. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddTransientBehavior(ISilverbackBuilder, Type)
Adds a scoped behavior of the type specified in behaviorType to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddTransientBehavior(this ISilverbackBuilder silverbackBuilder, Type behaviorType)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
| Type | behaviorType | The type of the behavior to register and the implementation to use. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
AddTransientBehavior<TBehavior>(ISilverbackBuilder)
Adds a scoped behavior of the type specified in TBehavior to the
IServiceCollection.
Declaration
public static ISilverbackBuilder AddTransientBehavior<TBehavior>(this ISilverbackBuilder silverbackBuilder) where TBehavior : class, IBehavior
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackBuilder | silverbackBuilder | The ISilverbackBuilder that references the IServiceCollection to add the behavior to. |
Returns
| Type | Description |
|---|---|
| ISilverbackBuilder | The ISilverbackBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TBehavior | The type of the behavior to add. |