New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Dapper users to specify custom default type maps #132
Conversation
…rate words as an alternative to camel case.
@ragnarok111 you have ability to create custom mappers in your code so this should not be in the default mapper and not in the main branch. Just create a custom mapper in your code and register it with Dapper. |
That is exactly what I would like to do. However, I cannot find any documentation on how to do that unless I want to write a custom mapper for every single type I am pulling from the database. Since most of my types come from a snake case database, I would like to be able to register a single mapper that will handle all of them and fall back to the default mapper. Or it could start with the default mapper and fall back to a custom one. Can you point me to any documentation on creating custom mappers? |
… to separate words as an alternative to camel case." This reverts commit 96bebb9.
Okay, I have changed my focus on this. I reverted my last change and added a new commit that will allow Dapper to use custom default type mappers that can fall back to the DefaultTypeMap. I added comments to the Commit to explain why I did things the way I did as well as an example mapper. |
What are the chances of this being merged? |
I simply need to have the time to go through it; I have finite resources, and lots of plates to keep spinning. The contribution is appreciated - I simply haven't had the time to review it or properly think about all the scenarios. |
I completely understand. Thanks for the reply. |
I hope this functionality works well, I also work with some snake case databases. |
@mgravell, if I rewrite this for this current version of Dapper, would there be a chance it would get merged? |
This is going in, but via a simpler implementation in #110. I really do appreciate the commit, the public/virtual bits especially are something we need to discuss. I think exposing the |
Edit: this pull request originated as a way to allow SNAKE_CASE in column names but has evolved into a way to allow users to specify custom default mappers.
This allows DefaultTypeMap to search for columns that use "_" to separate words as an alternative to camel case. Some older database systems, such as DB2 for iSeries only return columns in all caps. This make camel case difficult to deal with during development.