In making the switch to ASP.NET MVC, I’ve moved away from using my old Data Access Layer that I’ve used for years and have opted to use Dapper as my ORM of choice in the quest for optimal performance. My DAL was actually pretty optimized for WinForms and WebForms (using straight SQL Queries and SQL parameters) but mapping it to models wasn’t something I had in mind when I created it. I’m finding Dapper takes some getting used too but it is still pretty fast. The downside is that writing the code for Models to wire it up is proving to be a little tedious.
To that effect, I wrote a little application that has helped me generate the models from a database dynamically. It’s in it’s infancy stages and something I cobbled together in less than 8 hours but it works. I’ll add more features too as time goes on if there’s enough interest or to satisfy my own needs. In the meantime, I’m open sourcing the project as it may help others and I’d love to see it become something grander if others are willing to contribute to it. There’s also some useful bits of code that others may find useful to reference like dynamically reading fields from a database, pluralization/singularization of words, amongst others.
You can find the repository on Github: https://github.com/gregvarghese/MVCModelGenerator