tags:

views:

87

answers:

1

Hi guys,

I have ran into an issue where I am trying to ignore properties within properties. e.g.

Mapper.CreateMap<Node, NodeDto>()
                .ForMember(dest => dest.ChildNodes, opt => opt.Ignore())
                .ForMember(dest => dest.NodeType.EntityType.Properties, opt => opt.Ignore());

I get following exception:

{"Expression 'dest => dest.NodeType.EntityType.Properties' must resolve to top-level member.\r\nParameter name: lambdaExpression"}

Any idea?

A: 

Well I have managed to figure it out by myself. I have to specify the nested property options in its own dto mapping. However let me know if there is another better way of doing this

  Mapper.CreateMap<EntityType, EntityTypeDto>()
                .ForMember(dest => dest.Properties, opt => opt.Ignore());               
            Mapper.CreateMap<Node, NodeDto>()
                .ForMember(dest => dest.ChildNodes, opt => opt.Ignore());
nabeelfarid

related questions