I have an Object and need to select the Name property and assign it to String.
but it doesn't work!
who to write true Profiles mapping
class Tag
{
public string Name {get;set;}
}
public class TagProfile : ProfileBase
{
public TagProfile()
{
CreateMap<Tag, string>()
.ForMember(dest => dest, opt => opt.MapFrom(src => src.Name));
}
}
CodePudding user response:
you can try it on profile contractor:
CreateMap<Tag, string>()
.ConvertUsing(source => source.Name);