Reference > Configuration > Runtime
Entity Mapping
core concept: entity mapping
Generically specify a factory type
Syntax
Use<T>()
Arguments
- T
- – The generic parameter that specifies the type of `IMapperFactory`. `T` must have a public parameterless constructor.
Use a factory
Syntax
Use({factory}[,{configureTypes}])
Arguments
- factory
- – A factory responsible for creating entity mappers.
- configureTypes
- – A delegate that enables configuration of specific entity types.
syntax examples
Configure specific entities
When using a custom factory and registrations for specific entities are made, the custom factory MUST support those registrations (the dbExpression default factory does).
Configure entities using registered factory
Syntax
ForEntityTypes({configureTypes})
Arguments
- configureTypes
- – A delegate that allows for configuring entity factories for specific entity types.
Generically specificy a mapper for an entity type
Syntax
ForEntityType<T>().Use<TMapper>()
Arguments
- T
- – The generic parameter that specifies the type of `IDbEntity` to use the mapper for. `T` must have a public parameterless constructor.
- TMapper
- – AThe generic parameter that specifies the type of `IEntityMapper<T>` to use for mapping data to an instance of `T`. `TMapper` must have a public parameterless constructor.
Configure specific mapper for an entity type
Syntax
ForEntityType<T>().Use({factory})
Arguments
- T
- – The generic parameter that specifies the type of `IDbEntity` to use the mapper for. `T` must have a public parameterless constructor.
- factory
- – A factory responsible for creating entity mappers.
syntax examples