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

Discovering IEntityMap<> implementations dynamically #128

Closed vecilije closed 3 years ago

vecilije commented 3 years ago

@henkmollema I came with this solution when I was using your library while working with Dapper, and wanted to suggest it to you if that might be interesting. The implementation itself is a FluentMapConfiguration extension method which gives possibility to automatically discover types implementing IEntityMap<> for specific assemblies, so there is no need to add them manually (usually everyone will be inheriting from EntityMap<>, but it is implementing IEntityMap) . Usage:

FluentMapper.Configure(c => 
{
  c.ApplyMapsFromAssemblies(assemblies); // 
});
vecilije commented 3 years ago

Hi @henkmollema , thank you very much for considering this change. I did a commit based on your recommendation. Hope everything is fine now.

xthrush commented 3 years ago

I would like to support this change. in a finished form.