Windows Application AutoMapper Error: Unmapped members were found. Review the types and members below

Last Reply 7 months ago By dharmendr

Posted 7 months ago

I have set automapper to ignore some property but get error from it of unmapped member.

Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type

Automapper created this type map for you but your types cannote be

mapped using current configuration.

Articoli -> Product(Destination member list)

Unmapped properties:


Source: Automapper

    public class Product
        public Product()
            this.ProductVariant = new HashSet<ProductVariant>();
        public string Code{ get; set; }
        public string Description { get; set; }
        public virtual ICollection<ProductVariant> ProductVariant { get; set; }

    public  class ProductVariant
        public string Code{ get; set; }
        public string Variant { get; set; }        
        public virtual Product Product { get; set; }


static class Program
    /// <summary>
    /// Punto di ingresso principale dell'applicazione.
    /// </summary>
    static void Main()
        Mapper.Initialize(c => c.AddProfile<MappinProfile>());
        Application.Run(new Form1());

 In the mapping profile I do

public MappinProfile()
    var config = new MapperConfiguration(cfg => { 
         cfg.CreateMap<Articoli, Product>()
             .ForMember(n=> n.ProductVariant, opt=> opt.Ignore()); //nav property
         cfg.CreateMap<DescrizioniVariantiArt, ProductVariant>()
             .ForMember(n=> n.Product, opt=>opt.Ignore()); //nav property
    IMapper mapper = config.CreateMapper();