Class ServiceCollectionExtensions
Extensions to IServiceCollection for Couchbase dependency injection.
Inherited Members
Namespace: Couchbase.Extensions.DependencyInjection
Assembly: Couchbase.Extensions.DependencyInjection.dll
Syntax
public static class ServiceCollectionExtensions
Methods
| Edit this page View SourceAddCouchbase(IServiceCollection, IConfiguration)
Add Couchbase dependencies to the IServiceCollection.
Declaration
public static IServiceCollection AddCouchbase(this IServiceCollection services, IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
IConfiguration | configuration | Section from the configuration that can be bound to ClusterOptions. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
AddCouchbase(IServiceCollection, Action<ClusterOptions>?)
Add Couchbase dependencies to the IServiceCollection.
Declaration
public static IServiceCollection AddCouchbase(this IServiceCollection services, Action<ClusterOptions>? options)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
Action<ClusterOptions> | options | Optional action to configure the ClusterOptions. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
AddCouchbaseBucket<T>(IServiceCollection, string)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name.
Declaration
public static IServiceCollection AddCouchbaseBucket<T>(this IServiceCollection services, string bucketName) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | bucketName | The name of the Couchbase bucket. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
AddCouchbaseBucket<T>(IServiceCollection, string, Action<IBucketBuilder>?)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name.
Declaration
public static IServiceCollection AddCouchbaseBucket<T>(this IServiceCollection services, string bucketName, Action<IBucketBuilder>? buildAction) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | bucketName | The name of the Couchbase bucket. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
AddCouchbaseBucket<TService, TImplementation>(IServiceCollection, Action<IBucketBuilder>?)
Register an bucket via an interface inherited from INamedBucketProvider and a concrete implementation of that interface.
Declaration
public static IServiceCollection AddCouchbaseBucket<TService, TImplementation>(this IServiceCollection services, Action<IBucketBuilder>? buildAction = null) where TService : class, INamedBucketProvider where TImplementation : class, TService
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
TService | Interface inherited from INamedBucketProvider. |
TImplementation | Concrete implementation of |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
AddKeyedCouchbase(IServiceCollection, string?, IConfiguration)
Add Couchbase dependencies to the IServiceCollection.
Declaration
public static IServiceCollection AddKeyedCouchbase(this IServiceCollection services, string? serviceKey, IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
IConfiguration | configuration | Section from the configuration that can be bound to ClusterOptions. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
AddKeyedCouchbase(IServiceCollection, string?, Action<ClusterOptions>?)
Add Couchbase dependencies to the IServiceCollection.
Declaration
public static IServiceCollection AddKeyedCouchbase(this IServiceCollection services, string? serviceKey, Action<ClusterOptions>? options)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
Action<ClusterOptions> | options | Optional action to configure the ClusterOptions. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
AddKeyedCouchbaseBucket<T>(IServiceCollection, string?, string)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name.
Declaration
public static IServiceCollection AddKeyedCouchbaseBucket<T>(this IServiceCollection services, string? serviceKey, string bucketName) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
string | bucketName | The name of the Couchbase bucket. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
AddKeyedCouchbaseBucket<T>(IServiceCollection, string?, string?, Action<IBucketBuilder>?)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name.
Declaration
public static IServiceCollection AddKeyedCouchbaseBucket<T>(this IServiceCollection services, string? serviceKey, string? bucketName, Action<IBucketBuilder>? buildAction) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
string | bucketName | The name of the Couchbase bucket. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
AddKeyedCouchbaseBucket<TService, TImplementation>(IServiceCollection, string?, Action<IBucketBuilder>?)
Register an bucket via an interface inherited from INamedBucketProvider and a concrete implementation of that interface.
Declaration
public static IServiceCollection AddKeyedCouchbaseBucket<TService, TImplementation>(this IServiceCollection services, string? serviceKey, Action<IBucketBuilder>? buildAction = null) where TService : class, INamedBucketProvider where TImplementation : class, TService
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
TService | Interface inherited from INamedBucketProvider. |
TImplementation | Concrete implementation of |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
TryAddCouchbaseBucket<T>(IServiceCollection, string)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name if the interface hasn't already been added.
Declaration
public static IServiceCollection TryAddCouchbaseBucket<T>(this IServiceCollection services, string bucketName) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | bucketName | The name of the Couchbase bucket. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
TryAddCouchbaseBucket<T>(IServiceCollection, string, Action<IBucketBuilder>?)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name if the interface hasn't already been added.
Declaration
public static IServiceCollection TryAddCouchbaseBucket<T>(this IServiceCollection services, string bucketName, Action<IBucketBuilder>? buildAction) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | bucketName | The name of the Couchbase bucket. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
TryAddCouchbaseBucket<TService, TImplementation>(IServiceCollection, Action<IBucketBuilder>?)
Register a bucket via an interface inherited from INamedBucketProvider and a concrete implementation of that interface.
Declaration
public static IServiceCollection TryAddCouchbaseBucket<TService, TImplementation>(this IServiceCollection services, Action<IBucketBuilder>? buildAction = null) where TService : class, INamedBucketProvider where TImplementation : class, TService
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
TService | Interface inherited from INamedBucketProvider. |
TImplementation | Concrete implementation of |
TryAddKeyedCouchbaseBucket<T>(IServiceCollection, string?, string)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name if the interface hasn't already been added.
Declaration
public static IServiceCollection TryAddKeyedCouchbaseBucket<T>(this IServiceCollection services, string? serviceKey, string bucketName) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
string | bucketName | The name of the Couchbase bucket. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
TryAddKeyedCouchbaseBucket<T>(IServiceCollection, string?, string, Action<IBucketBuilder>?)
Register an interface based on INamedBucketProvider which will be injected with a specific bucket name if the interface hasn't already been added.
Declaration
public static IServiceCollection TryAddKeyedCouchbaseBucket<T>(this IServiceCollection services, string? serviceKey, string bucketName, Action<IBucketBuilder>? buildAction) where T : class, INamedBucketProvider
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
string | bucketName | The name of the Couchbase bucket. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
T | Interface inherited from INamedBucketProvider. Must not add any members. |
Remarks
This method is not AOT-compatible. Use the overload that accepts a concrete implementation.
TryAddKeyedCouchbaseBucket<TService, TImplementation>(IServiceCollection, string?, Action<IBucketBuilder>?)
Register a bucket via an interface inherited from INamedBucketProvider and a concrete implementation of that interface.
Declaration
public static IServiceCollection TryAddKeyedCouchbaseBucket<TService, TImplementation>(this IServiceCollection services, string? serviceKey, Action<IBucketBuilder>? buildAction = null) where TService : class, INamedBucketProvider where TImplementation : class, TService
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection. |
string | serviceKey | Service key to uniquely represent the cluster. |
Action<IBucketBuilder> | buildAction | Action to perform further configuration. |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection. |
Type Parameters
Name | Description |
---|---|
TService | Interface inherited from INamedBucketProvider. |
TImplementation | Concrete implementation of |