SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)

    Rediscovering SqlClient

    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.

  2. #2
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Serenarules View Post
    ... 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.
    The way I understand it is that DDD/TDD are more important when working with a team with distinct jobs in the process. This is something I never do so I very much agree with you.

    ORM = convenience to me. With or without is of no consequence.

    I'm jumping ship to Ruby on Rails anyway.

  3. #3
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Jersey
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Raven or Mongo are the way to go. That or the jumping ship idea
    Matt Daly

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,623
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Don't know about mongo -- just doesn't feel safe enough for my data. But RavenDb or CouchDb are great options for the right data shapes and application types.

    Using straight ADO.NET is a reasonable option for apps of the right shape and nature. I really wouldn't want it strewn about my controllers but rather in a middleware layer of some sort, if for nothing else than for non-web or other website use cases.

  5. #5
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Eh, well I wouldn't put it in the controller for real. I've adopted a scaled down version of CQRS, without the Event Sourcing component, so the only place you'll see sqlclient is in a CommandHandler or a QueryHandler.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •