Results 1 to 5 of 5
Thread: Rediscovering SqlClient
Nov 6, 2011, 18:56 #1
Out of recent frustrations with an overly complex domain model, one that was impossible to create routes for, and issues with persistence mapping, an interesting realization was born. I threw caution to the wind and duplicated my current project (real client) using SqlClient instead of EntityFramwork or NHibernate. I scrapped all the domain objects, the mapping classes, the configuration classes, factory classes, dependency injection, automapper and several other things. Instead, I performed simple SqlClient code right in the mvc actions that needed them. I used SqlDataReaders to push data right onto the view models and pushed SqlParameters into the SqlCommand right from incoming view models. The result was extremely fast. Faster than I think any app written by me recently has ever been. Granted, there was a bit of code duplication from action to action, but you know what? Compared to everything I sacked to write this, there was still far less code overall. What was surprising is that it ran more efficiently than before. I know I will probably get trashed for this, but everything was so simple and elegant, I wonder why I ever moved to something else. Honestly, I am beginning to believe that a lot of what people tout as the correct way to do things (read DDD/TDD/ORM here) are extremely overrated. Just my thoughts at this point.