Show / Hide Table of Contents

Class CosmosRegistrationHelper

Inheritance
object
CosmosRegistrationHelper
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.CosmosDb.Utilities
Assembly: Benday.CosmosDb.dll
Syntax
public class CosmosRegistrationHelper

Constructors

| Edit this page View Source

CosmosRegistrationHelper(IServiceCollection, CosmosConfig)

Declaration
public CosmosRegistrationHelper(IServiceCollection services, CosmosConfig config)
Parameters
Type Name Description
IServiceCollection services
CosmosConfig config

Properties

| Edit this page View Source

AllowBulkExecution

Declaration
public bool AllowBulkExecution { get; }
Property Value
Type Description
bool
| Edit this page View Source

Configuration

Declaration
public CosmosConfig? Configuration { get; }
Property Value
Type Description
CosmosConfig
| Edit this page View Source

ConnectionString

Declaration
public string ConnectionString { get; }
Property Value
Type Description
string
| Edit this page View Source

ContainerName

Declaration
public string ContainerName { get; }
Property Value
Type Description
string
| Edit this page View Source

DatabaseName

Declaration
public string DatabaseName { get; }
Property Value
Type Description
string
| Edit this page View Source

PartitionKey

Declaration
public string PartitionKey { get; }
Property Value
Type Description
string
| Edit this page View Source

UseDefaultAzureCredential

Declaration
public bool UseDefaultAzureCredential { get; }
Property Value
Type Description
bool
| Edit this page View Source

UseGatewayMode

Declaration
public bool UseGatewayMode { get; }
Property Value
Type Description
bool
| Edit this page View Source

UseHierarchicalPartitionKey

Declaration
public bool UseHierarchicalPartitionKey { get; }
Property Value
Type Description
bool
| Edit this page View Source

WithCreateStructures

Declaration
public bool WithCreateStructures { get; }
Property Value
Type Description
bool

Methods

| Edit this page View Source

ConfigureDiagnosticsDefault(Action<CosmosRepositoryDiagnosticsOptions>)

Configures the registry default that applies to any entity type that does not have an explicit ConfigureDiagnostics<TEntity>(Action<CosmosRepositoryDiagnosticsOptions>) entry. Useful for turning a flag on globally and then disabling it for hot-path repositories.

Declaration
public CosmosRegistrationHelper ConfigureDiagnosticsDefault(Action<CosmosRepositoryDiagnosticsOptions> configure)
Parameters
Type Name Description
Action<CosmosRepositoryDiagnosticsOptions> configure

Callback that mutates the default options.

Returns
Type Description
CosmosRegistrationHelper

This helper, for fluent chaining.

| Edit this page View Source

ConfigureDiagnostics<TEntity>(Action<CosmosRepositoryDiagnosticsOptions>)

Configures per-entity diagnostic options for repositories that manage TEntity. The options are looked up by the repository in its constructor via CosmosDiagnosticsRegistry.

Declaration
public CosmosRegistrationHelper ConfigureDiagnostics<TEntity>(Action<CosmosRepositoryDiagnosticsOptions> configure)
Parameters
Type Name Description
Action<CosmosRepositoryDiagnosticsOptions> configure

Callback that receives the entity's options for mutation. Called once per call.

Returns
Type Description
CosmosRegistrationHelper

This helper, for fluent chaining.

Type Parameters
Name Description
TEntity

The repository's entity type.

Examples
helper.ConfigureDiagnostics<Note>(o => o.CaptureIndexMetrics = true);
| Edit this page View Source

RegisterParentedRepositoryAndService<TEntity>()

Registers a repository and service for a parented item entity type using default implementations.

Declaration
public void RegisterParentedRepositoryAndService<TEntity>() where TEntity : ParentedItemBase, new()
Type Parameters
Name Description
TEntity

Entity type that inherits from ParentedItemBase

| Edit this page View Source

RegisterParentedRepository<TEntity>()

Registers a repository for a specific parented item entity type using default implementation of CosmosDbParentedItemRepository.

Declaration
public void RegisterParentedRepository<TEntity>() where TEntity : ParentedItemBase, new()
Type Parameters
Name Description
TEntity

Entity type that inherits from ParentedItemBase

| Edit this page View Source

RegisterParentedRepository<TEntity, TInterface, TImplementation>()

Registers a repository for a specific parented item entity type using a custom implementation of the repository.

Declaration
public void RegisterParentedRepository<TEntity, TInterface, TImplementation>() where TEntity : ParentedItemBase, new() where TInterface : class where TImplementation : class, TInterface
Type Parameters
Name Description
TEntity

Entity type that inherits from ParentedItemBase

TInterface

Repository interface

TImplementation

Repository implementation

| Edit this page View Source

RegisterRepositoryAndService<TEntity>()

Registers a repository and service for a domain model entity type using default implementations.

Declaration
public void RegisterRepositoryAndService<TEntity>() where TEntity : TenantItemBase, new()
Type Parameters
Name Description
TEntity
| Edit this page View Source

RegisterRepository<TEntity>()

Registers a repository for a specific domain model entity type.

Declaration
public void RegisterRepository<TEntity>() where TEntity : TenantItemBase, new()
Type Parameters
Name Description
TEntity
| Edit this page View Source

RegisterRepository<TEntity, TInterface, TImplementation>()

Registers a repository for a specific domain model entity type using a custom implementation of the repository.

Declaration
public void RegisterRepository<TEntity, TInterface, TImplementation>() where TEntity : TenantItemBase, new() where TInterface : class where TImplementation : class, TInterface
Type Parameters
Name Description
TEntity
TInterface
TImplementation
| Edit this page View Source

RegisterRepository<TEntity, TInterface, TImplementation>(string?, string?, string?, string?, bool?, bool?, bool?)

Registers a repository for a specific domain model entity type using a custom configuration values. Null or empty values will use the defaults from the helper instance.

Declaration
public void RegisterRepository<TEntity, TInterface, TImplementation>(string? connectionString = null, string? databaseName = null, string? containerName = null, string? partitionKey = null, bool? useHierarchicalPartitionKey = null, bool? useDefaultAzureCredential = null, bool? withCreateStructures = null) where TEntity : TenantItemBase, new() where TInterface : class where TImplementation : class, TInterface
Parameters
Type Name Description
string connectionString
string databaseName
string containerName
string partitionKey
bool? useHierarchicalPartitionKey
bool? useDefaultAzureCredential
bool? withCreateStructures
Type Parameters
Name Description
TEntity
TInterface
TImplementation
| Edit this page View Source

WithQueryLogSink(ICosmosQueryLogSink)

Registers a specific ICosmosQueryLogSink instance to receive query diagnostics. Useful for test scenarios where a pre-constructed capture sink should be used.

Declaration
public CosmosRegistrationHelper WithQueryLogSink(ICosmosQueryLogSink sink)
Parameters
Type Name Description
ICosmosQueryLogSink sink

The sink instance. Registered as a singleton.

Returns
Type Description
CosmosRegistrationHelper

This helper, for fluent chaining.

| Edit this page View Source

WithQueryLogSink<TSink>()

Registers a custom ICosmosQueryLogSink to receive query diagnostics from every repository. If no sink is explicitly registered, the default NoOpCosmosQueryLogSink is used.

Declaration
public CosmosRegistrationHelper WithQueryLogSink<TSink>() where TSink : class, ICosmosQueryLogSink
Returns
Type Description
CosmosRegistrationHelper

This helper, for fluent chaining.

Type Parameters
Name Description
TSink

The sink implementation type. Registered as a singleton.

  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com