henkmollema / Dapper-FluentMap

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

Exception when mapping an inherited property in a derived object #56

Closed orenht closed 6 years ago

orenht commented 7 years ago

Hi,

I have a type B that inherits from type A, and a Property P defined in A. When I try to map that property in type B, an exception is thrown at the DommelColumnNameResolver, that the key is not present in the entity maps dictionary.

I suggest that instead of using the DeclaringType for the lookup, use the ReflectedType.

Maybe this issue exists in other places too, I haven't checked.

henkmollema commented 7 years ago

That is indeed a known issue. However, ReflectedType is not available in .NET Standard 1.3 (which Dapper.FluentMap and Dommel) targets. A future version might target .NET Standerd 2.0 which allows us to use RefelectedType again.

henkmollema commented 6 years ago

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.

Dapper.FluentMap.Dommel is updated as well: https://www.nuget.org/packages/Dapper.FluentMap.Dommel/1.6.0.

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