Couchbase .NET SDK | 3.7.2
Search Results for

    Show / Hide Table of Contents

    Class ServiceCollectionExtensions

    Extensions to IServiceCollection for Couchbase dependency injection.

    Inheritance
    object
    ServiceCollectionExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Couchbase.Extensions.DependencyInjection
    Assembly: Couchbase.Extensions.DependencyInjection.dll
    Syntax
    public static class ServiceCollectionExtensions

    Methods

    | Edit this page View Source

    AddCouchbase(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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 TService.

    Remarks

    This method is not AOT-compatible. Use the overload that accepts a concrete implementation.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 TService.

    Remarks

    This method is not AOT-compatible. Use the overload that accepts a concrete implementation.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 TService.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 TService.

    • Edit this page
    • View Source
    In this article
    Back to top © 2025 Couchbase, Inc.