Is there way to abort the map?

13 views
Skip to first unread message

Mats Sarapik

unread,
May 4, 2021, 7:11:25 AMMay 4
to AutoMapper-users
If there for some reason is impossible to create the destination object, is it possible to just abort the mapping and return null?
Of course on could validate before even calling. But anyway ...
I can use .ConstructUsing((src, dest) => and return a valid object or null, but that will continue with the .ForMembers, and will of course crash.

Any tips?

/Mats

Jimmy Bogard

unread,
May 4, 2021, 8:05:50 AMMay 4
to automapp...@googlegroups.com
No, there’s not.

On May 4, 2021, at 6:11 AM, Mats Sarapik <mats_s...@trimble.com> wrote:

If there for some reason is impossible to create the destination object, is it possible to just abort the mapping and return null?
--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automapper-users/95ab5362-5ed4-4bd1-a08c-fb36b7bb3744n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages