Table of Contents

Interface IMongoClientFactory<TContext>

Namespace
Arc4u.MongoDB
Assembly
Arc4u.MongoDB.dll

Define the behavior expected from the factory to create a mongo client and retrieve the database (part of the description).

public interface IMongoClientFactory<TContext> where TContext : DbContext

Type Parameters

TContext

The type of the database context.

Methods

CreateClient()

Gets the MongoDB client of the context.

IMongoClient CreateClient()

Returns

IMongoClient

The client.

GetCollection<TEntity>()

Gets the collection the entity type is mapped to in the DbContext.

IMongoCollection<TEntity> GetCollection<TEntity>()

Returns

IMongoCollection<TEntity>

The collection.

Type Parameters

TEntity

The document type of the collection.

GetCollection<TEntity>(string)

Gets a collection of the database by name.

IMongoCollection<TEntity> GetCollection<TEntity>(string collectionName)

Parameters

collectionName string

The name of the collection.

Returns

IMongoCollection<TEntity>

The collection.

Type Parameters

TEntity

The document type of the collection.