Skip to content

Map Interface to concrete Type failed in v11.0.0 #3867

@MM-RYO

Description

@MM-RYO

Hi,
I want to map Entity1 to Entity1Map and TagData to TagData2.
the TagData2 is implemented IData2 you can see the mapping configuration below.
It works in v10.2.2 not in v11.0.0. I also tested it in 11.0.1-alpha.0.9. it doesn't work.

The Generic type mapping also changed in v11.0.0
I can do the below mapping for Generic type in v10

CreateMap(typeof(type1<>), typeof(type2<>));

but now I have to specify the type
CreateMap(typeof(type1), typeof(type1));

Source/destination types

Try to map Entity1 to Entity1Map

  var testService = new TestService();
  var entities = testService.GetEntity1s();
  var mapEntities = _mapper.Map<IEnumerable<Entity1Map>>(entities);

Mapping configuration

CreateMap<Entity1, Entity1Map>();
CreateMap<TagData, TagData2>();

Version: 11.0.0

Expected behavior

Should be able to map to target type

Actual behavior

Error mapping types.
Missing type map configuration or unsupported mapping.

Mapping types:
TagData -> IData2
Project1.TagData -> Project1.IData2

Destination Member:
Tags

Steps to reproduce

Framework: .net6
IDE: VS2022

I have attached a demo project
Project1.zip

  1. Launch the project wait a moment and let it be ready
  2. Click 'Fetch data' menu on the top right corner
  3. Go to MapTestController and TestProfile to check codes for more info

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions