Automapper map from inner property to destination class

automapper, c#

Solution

As usual, right after I hit post question button:

Mapper.Reset();
// from, to
Mapper.CreateMap<InnerValue, DestinationClass>();
Mapper.CreateMap<SourceClass, DestinationClass>()
    .ConvertUsing(s => Mapper.Map<InnerValue, DestinationClass>(s.Inner));

Mapper.AssertConfigurationIsValid();

var source = new SourceClass() { Inner = new InnerValue() { InnerPropertyId = 123, StringValue = "somethinges" } };

var dest = Mapper.Map<SourceClass, DestinationClass>(source);

Problem

Cant' seem to figure this one out. ``` public class DestinationClass { public int InnerPropertyId { get; set; } public string StrignValue { get; set; } } public class SourceClass { public InnerValue Inner { get; set; } } public class InnerValue { public int InnerPropertyId { get; set; } public string StrignValue {get;set;} } ``` I need to map from SourceClass.InnerValue directly to DestinationClass. How do I do that? Thanks in advance.

Original source