Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Linq to SQL vs Nhibernate or Castle ActiveRecord

Linq to SQL vs Nhibernate or Castle ActiveRecord

Scheduled Pinned Locked Moved LINQ
csharpdatabasevisual-studiolinqquestion
3 Posts 3 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Austin Harris
    wrote on last edited by
    #1

    Does Linq to sql deprecate Nhibernate and Active record? I have a client that wants to use active record, and It looks like the last update to it was 10 months ago. This concerns me a bit. It also seems to be much more work to get ActiveRecord mapped to my database then it does for Linq to Sql. I'm using Visual Studio 2008. Is there a Good way to generate the mappings and classes for active record? I don't want to spend 3 days doing it manually. I need some more information so that I have a good argument as to why Linq to Sql is superior and should be used instead.

    H 1 Reply Last reply
    0
    • A Austin Harris

      Does Linq to sql deprecate Nhibernate and Active record? I have a client that wants to use active record, and It looks like the last update to it was 10 months ago. This concerns me a bit. It also seems to be much more work to get ActiveRecord mapped to my database then it does for Linq to Sql. I'm using Visual Studio 2008. Is there a Good way to generate the mappings and classes for active record? I don't want to spend 3 days doing it manually. I need some more information so that I have a good argument as to why Linq to Sql is superior and should be used instead.

      H Offline
      H Offline
      Howard Richards
      wrote on last edited by
      #2

      As no-one has replied I'll give you a few ideas. I'll qualify this by saying I don't use NHibernate or ActiveRecord and am not familiar with them. Why I use LINQ to SQL: 1. Easy to learn and use 2. Good performance, lightweight objects 3. Use same LINQ syntax for multiple datasources e.g. not just SQL, there is LINQ to XML, Objects, Entities.. 4. Easy to read code For example I noticed this sample code on the NHibernate site just now:

      //finds a list of People with the same 'Name' property
      ICriteria criteria = session.CreateCriteria(typeof(Person));
      criteria.SetProjection(Projections.ProjectionList()
      .Add(Projections.Max("Id"))
      .Add(Projections.GroupProperty("Name")))
      .Add(Restrictions.Gt(Projections.Count("Name"), 1));
      IList results = criteria.List();

      Not particularly easy to read. Here's the LINQ to SQL equivalent:

      var results = from p in db.People
      where (from p2 in db.People
      group p2.Name by p2.Name into g
      where g.Count() > 1
      select g.Key).Contains(p.Name)
      select new { p.ID, p.Name };

      The LINQ to SQL query is a lot closer to the SQL query structure and is easier to read.

      'Howard

      R 1 Reply Last reply
      0
      • H Howard Richards

        As no-one has replied I'll give you a few ideas. I'll qualify this by saying I don't use NHibernate or ActiveRecord and am not familiar with them. Why I use LINQ to SQL: 1. Easy to learn and use 2. Good performance, lightweight objects 3. Use same LINQ syntax for multiple datasources e.g. not just SQL, there is LINQ to XML, Objects, Entities.. 4. Easy to read code For example I noticed this sample code on the NHibernate site just now:

        //finds a list of People with the same 'Name' property
        ICriteria criteria = session.CreateCriteria(typeof(Person));
        criteria.SetProjection(Projections.ProjectionList()
        .Add(Projections.Max("Id"))
        .Add(Projections.GroupProperty("Name")))
        .Add(Restrictions.Gt(Projections.Count("Name"), 1));
        IList results = criteria.List();

        Not particularly easy to read. Here's the LINQ to SQL equivalent:

        var results = from p in db.People
        where (from p2 in db.People
        group p2.Name by p2.Name into g
        where g.Count() > 1
        select g.Key).Contains(p.Name)
        select new { p.ID, p.Name };

        The LINQ to SQL query is a lot closer to the SQL query structure and is easier to read.

        'Howard

        R Offline
        R Offline
        Roger Alsing 0
        wrote on last edited by
        #3

        NHibernate has linq support so you can very well do the same in NHibernate... NHibernate is way more powerful than Linq to SQL when it comes to features. Actually, none of your arguments can be used against NHibernate since NH has more lightweight objects and in many cases better SQL generation.

        My Blog

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups