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
collectionNamestringThe name of the collection.
contextBuilderDbContextBuilderThe 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
TEntityThe 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.