Mapster EqualityComparison

Hi. How i can pass self reference to nested method of mapping?
1 Reply
~FallenParadise~
ie i has config like
cfg....
.MapToTargetWith((a,b)=>Method(a,b));


IEnumerable<X> Method(IEnumerable<X> a,IEnumerable<Y> b)
{

// there i need to get mapper instance to map from Y to X
// kinda
foreach(var x in a)
{
mapper.From(b[x.Id]).AdaptTo(x);
}

}
cfg....
.MapToTargetWith((a,b)=>Method(a,b));


IEnumerable<X> Method(IEnumerable<X> a,IEnumerable<Y> b)
{

// there i need to get mapper instance to map from Y to X
// kinda
foreach(var x in a)
{
mapper.From(b[x.Id]).AdaptTo(x);
}

}
or simmilar i wanna keep ref array and add / remove from it items but to made it flexible i wanna keep using mapper there and need to check on items count and their ids. Remove from A if id not found in B or add it if it exsists on B but dosent on A Well i remember rules. But it seems thats more #advanced issue than just help-0 Thata why i post it in 2 channels Ye. Will wait for that feature =) So where i need to delete it? Is it advanced? Whats about mine question? So. I have 2 lists. I wanna adapt one to another And while adapting i wanna project from list B to list A items with same ID If ID wasn't found on A - create item. If was on A but wasnt on B delete it And it's kinda simple if else and expression for equality comparison. But if i wanna project simply from item A to item B i need to pass mapper to child method I mean child method where logic about add/remove items and projection it You can use MapToTargetWith extension method and pass there that mapping method But there is no override that will also pass mapper itself to that method Any ideas? @tebeco ?