Table of Contents

Class WithType

Namespace
Arc4u.MongoDB.Configuration
Assembly
Arc4u.MongoDB.dll

Second step of the mapping of a collection: declares the entity types it stores.

public class WithType
Inheritance
WithType
Inherited Members

Constructors

WithType(string, DbContextBuilder)

Creates the mapping step for a collection.

public WithType(string collectionName, DbContextBuilder contextBuilder)

Parameters

collectionName string

The name of the collection.

contextBuilder DbContextBuilder

The builder that records the mapping.

Methods

With<TEntity>()

Maps the entity type to the collection.

public WithType With<TEntity>() where TEntity : class

Returns

WithType

This object, to declare another entity type for the same collection.

Type Parameters

TEntity

The entity type stored in the collection.

Remarks

An entity type can be mapped to several collections by calling MapCollection once per collection; reading it without a collection name then fails. Mapping the same type to the same collection twice throws an ArgumentException.