henkmollema / Dapper-FluentMap

Provides a simple API to fluently map POCO properties to database columns when using Dapper.
MIT License
427 stars 86 forks source link

System.Exception: 'Duplicate mapping detected. Property 'Level' is already mapped to column 'Level'.' #126

Closed drma-tech closed 1 year ago

drma-tech commented 3 years ago
public class BadgeMapper : EntityMap<BadgeVM>
    {
        public BadgeMapper()
        {
            Map(p => p.Rank.Level)
                .ToColumn("Rank_Level");

            Map(p => p.Seniority.Level)
                .ToColumn("Seniority_Level");

            Map(p => p.CompletedProfile.Level)
                .ToColumn("CompletedProfile_Level");

            Map(p => p.VerifiedProfile.Level)
                .ToColumn("VerifiedProfile_Level");

            Map(p => p.Popular.Level)
                .ToColumn("Popular_Level");
        }
    }

I saw that you had a similar ticket. I don't know if it's the same situation, but the error is the same.

henkmollema commented 3 years ago

Do you have a full stack trace?

drma-tech commented 3 years ago
   at Dapper.FluentMap.Mapping.EntityMapBase`2.ThrowIfDuplicateMapping(IPropertyMap map)
   at Dapper.FluentMap.Mapping.EntityMapBase`2.Map(Expression`1 expression)
   at VerusDate.Shared.Mapper.BadgeMapper..ctor() in C:\Users\dhiog\source\repos\drma-dev\VerusDate\src\Shared\Mapper\BadgeMapper.cs:line 13

It doesn't help much. But this is easy to reproduce, because I believe that the component is not recognizing attributes of another class

drma-tech commented 3 years ago

Are there no plans to support attributes of other classes? Like value objects? @henkmollema