Skip to content

Mapper Types

Leonardo Porro edited this page Jan 27, 2023 · 4 revisions

Mapper types are regular .NET types associated to a certain behavior and/or specific mapper / mapper factory.

Mapper Types handled

Simple, plain values, with no members or indexers, such as int, string, bool, etc.
Any other type whose members or items shouldn't be recursively mapped, for example DbGeography. Similar to .NET primitives, but may include any other type that is not a primitive but should be handled as one.

Type with a set of members (i.e.: properties) that should be inspected and recursively mapped. Includes .NET classes, but also extends to any structure that can represent a set of member->value pairs, like a Dictionary<string, object>.

Schema with items, that should be iterated and recursively mapped. Usually .NET enumerables, except for string and any other type configured as primitive.

Special cases of Complex type

It's a complex type with a special entity flag and one or more members defined as key. The mapper handles entity types diferently than complex types, doing comparisons by key and merging as needed, to keep the graph in sync with the ORMs.

Complex type, similar to an entity, but used as the source (input) of a Map operation while the entity is the target. It doesn't need to have key members defined, but the key members of the target entity should exist and have a value in source DTO.