-
How can i set up the mapping of 3 source properties to one destination property that has public class DestinationItem
{
public required bool IsAccessible { get; set; }
} public class BasicItem
{
public bool? IsLocked { get; set; }
public bool? ErrorMessage { get; set; }
public bool? IsBlocked{ get; set; }
} I want something like this [UserMapping]
private static bool MapIsAccessible(BasicItem item)
=> (!item.ErrorMessage ?? true) && (!item.IsLocked ?? true) && (!item.IsBlocked?? true); So basically all those 3 properties are logically combined to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Starting with Mapperly However it may be easier to just introduce a get only property |
Beta Was this translation helpful? Give feedback.
Starting with Mapperly
3.6.0-next.1
you can useMapPropertyFromSource
exactly for this: docs.Would look sth. like this for you:
[MapPropertyFromSource(nameof(DestinationItem.IsAccessible), Use = nameof(MapIsAccessible))]
.However it may be easier to just introduce a get only property
IsAccessible
on yourBasicItem
.