henkmollema / Dommel

CRUD operations with Dapper made simple.
MIT License
611 stars 99 forks source link

DefaultTypeMap.MatchNamesWithUnderscores stops working with Dommel #211

Closed mertkokusen closed 4 years ago

mertkokusen commented 4 years ago

Hi,

I am currently using Dapper for sql queries and I want to use Dommel for inserts and updates.

Our column names are in snake case. So I set DefaultTypeMap.MatchNamesWithUnderscores and it works fine. But when I set a table resolver using DommelMapper class this stops working. I think it's because the static constructor of DommelMapper overwrites TypeMapProvider. Is it possible to keep MatchNamesWithUnderscores functionality and at the same time use custom table resolver and column resolver for inserts and updates?

Thanks.

henkmollema commented 4 years ago

The type map provider is overwritten to support mapping via the [Column] attribute. I guess we could fall back to the default/original type map provider in case no attribute was specified rather than only matching on exact property names.