darrencauthon/AutoMapperAssist — Issue #3: inject child mappers
Author: sloncho
Created: 2011-10-19 13:22:14+00:00
State: open

Thanks for your response on #2.

Now I'm fighting with something else. Let's say I created a mapper for a child object(s). And I'd like to inject it into a new mapper for a parent object. Looks like I can not find an easy way for this. I mean something like

public class ChildDtoToChildMapper : Mapper
{
public override DefineMap(...){..do mapping for child }
}

public class ParentDtoToParent
{
private readonly Mapper childMapper;
public ParentDtoToParent(Mapper childMapper)
{ this.childMapper = mapper; }

publci override void DefineMap(....)
{
//...create map for the parrent
// ??? how to use the injected mapper for ParentDto.ChildDto ???
}
}

Any pointers?