Add TypeMapperBuilder to use Dapper without setting Attributes on Model classes#463
Add TypeMapperBuilder to use Dapper without setting Attributes on Model classes#463vantheshark wants to merge 2 commits into
Conversation
|
Initial thoughts: IMO this is very heavy handed attempting to be fluent where isn't not needed (nor a common thing in our patterns currently). It seems to be this could be much simpler, simply registering the properties as keys via The above assumes the feature is really needed, and I'm not sure this is the case - there may be other even simpler approaches. |
|
The current code has private static dictionaries to cache PropertyInfo object by types. I'm not sure how to cache the custom PropertyInfo using nameof() without changing CRUID sync/async methods in SqlMapperExtensions.cs. I came to this as I want to use "async" InsertAsync() method while I cannot put attributes to my model classes. Anyways, It's quite fun to play with dnx the first time ;) |
|
Closing this out to cleanup - the notes above stand. I don't disagree with the general premise of pluggability here, but the API compared to the rest of dapper is very foreign, e.g. nothing looks or feels like this in any fundamental way. I don't want to dismiss the idea of making this extensible, only the implementation approach as it stands. We want to make the mappings pluggable in v2. I'll be adding it to the project notes there (a link will appear below shortly). |
For classes that we can not change to add attributes
Usages:
OR