I wanna add MaxDepth(0) to all mapped types as the followings:
CreateMap<AdvertisementStatistic, AdvertisementStatisticModel>().MaxDepth(0);
...
...
...
Is it an option to add this feature to all types simpler instead of adding .MaxDepth(0); at the end of each type in version 5?
Have you looked at ForAllMaps?
On Tuesday, July 12, 2016, Mohammmad Dayyan [email protected]
wrote:
I wanna add MaxDepth(0) to all mapped types as the followings:
CreateMap
().MaxDepth(0);
...
...
...Is it an option to add this feature to all types simpler instead of adding
.MaxDepth(0); at the end of each type ?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/AutoMapper/AutoMapper/issues/1510, or mute the thread
https://github.com/notifications/unsubscribe/AAGYMqA4LySF402UZO4a6Fu8gjvHrXPGks5qU47JgaJpZM4JKXOq
.
And instead of MaxDepth, PreserveReferences might help.
What is PreserverReferences?
It preserves references in case you have deep, circular maps.
You can do:
cfg.CreateMap<Foo, Bar>();
cfg.ForAllMaps((typeMap, mapConfig) => mapConfig.MaxDepth(0));
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.