How to AutoMapper a Source's Member's Property to Destination Property?
In these 3 classes, how do you map SourceString
to DestinationString
?
public class MySourceClass
{
public AnotherClass AnotherClass { get; set; }
}
public class AnotherClass
{
public string SourceString { get; set; }
}
// [AutoMap(typeof(MySourceClass))] // <--this doesn't seem to help
public class MyDestinationClass
{
//[SourceMember( nameof(AnotherClass.SourceString) )] <--not a winner
public string DestinationString { get; set; } // <-- this should map to AnotherClass.SourceString
}
If there were a way to do this in the CreateMap
method, it seems like a better place to keep the logic. Any help is appreciated!
from Recent Questions - Stack Overflow https://ift.tt/34tmoJC
https://ift.tt/eA8V8J
Comments
Post a Comment