Using AutoMapper to map the property of an object to a string

This is because you are trying to map to the actual destination type rather than a property of the destination type. You can achieve what you want with:

Mapper.CreateMap<Tag, string>().ConvertUsing(source => source.Name ?? string.Empty);

although it would be a lot simpler just to override ToString on the Tag class.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)