Skip to content

Commit 317d2d7

Browse files
committed
Include/IncludeBase applies recursively, so you only need to include the closest level in the hierarchy.
1 parent 7b46628 commit 317d2d7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/Mapping-inheritance.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ CreateMap<DerivedEntity, DerivedDto>()
2525
.IncludeBase<BaseEntity, BaseDto>();
2626
```
2727

28-
In each case above, the derived mapping inherits the custom mapping configuration from the base mapping configuration.
28+
In each case above, the derived mapping inherits the custom mapping configuration from the base map.
2929

30-
To include all derived maps, from the base type map configuration:
30+
`Include`/`IncludeBase` applies recursively, so you only need to include the closest level in the hierarchy.
31+
32+
If for some base class you have many directly derived classes, as a convenience, you can include all derived maps from the base type map configuration:
3133

3234
```c#
3335
CreateMap<BaseEntity, BaseDto>()
3436
.IncludeAllDerived();
3537

3638
CreateMap<DerivedEntity, DerivedDto>();
3739
```
40+
Note that this will search all your mappings for derived types and it will be slower than explicitly specifying the derived maps.
3841

3942
### Runtime polymorphism
4043

0 commit comments

Comments
 (0)