Skip to content

1.5.* fails with Dapper multi mapping where 1.4.1 works #42

Closed

Description

@cpisto

On .net 4.5.2 (Dapper 1.50.2), Dapper.FluentMap 1.5.0 and 1.5.1 using the PropertyTransformConvention from the readme applied via:

FluentMapper.Initialize(config =>
{
    config.AddConvention<PropertyTransformConvention>()
          .ForEntitiesInCurrentAssembly("App.Domain.Models")
}

in conjunction with Dapper multi mapping throws an exception:

Finding mappings for column 'id' yielded more than 1 PropertyMap. The conventions should be more specific.

Works perfectly with 1.4.1 and below.

Activity

  1. henkmollema commented on Aug 16, 2016

    @henkmollema
    Collaborator

    That's odd. Nothing should have changed there. Does your entity and database table still looks the same?

  2. cpisto commented on Aug 16, 2016

    @cpisto
    Author

    Yes everything is the same, swapping 1.5.* for 1.4.1 fixes the issue.

    In my example, both tables have an id column, however only one of the entities being multi-mapped has a matching Id property.

    I will try to find time to build a specific test case later this week.

  3. bengavin commented on Dec 14, 2016

    @bengavin

    We are seeing a similar issue when moving to 1.5.1 from 1.4.x, in our case, it seems to be directly related to inheritance hierarchies. When we register a global property prefix, we're seeing the duplicate property map error showing up. Commenting out the ForEntity<> for the derived classes (or base class) makes the problem go away, but prevents the conventions from apply to those excluded entities.

    Based on the test project, although I've been unable to get it to fail at this point (haven't had time to figure out what code path Dapper is using), but setting up the mapping to look like:

    FluentMapper.Initialize(c => 
    {
       c.AddConvention<TestPrefixConvention>()
           .ForEntity<TestEntity>()
           .ForEntity<DerivedTestEntity>();
    });

    edit: use syntax highlighting

  4. modified the milestone: v2.0 on Aug 22, 2017
  5. modified the milestones: v2.0, v1.7.0 on Nov 16, 2018
  6. henkmollema commented on Nov 16, 2018

    @henkmollema
    Collaborator

    This have been fixed for applications targeting full .NET (e.g. 4.5 or higher) and .NET Core 2.0 and 2.1 in version 1.7.0: NuGet and release notes.

    Please re-open or create a new issue if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址