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. The Lounge
  3. To ORM or not to ORM

To ORM or not to ORM

Scheduled Pinned Locked Moved The Lounge
databaseperformancecsharppostgresql
75 Posts 31 Posters 0 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.
  • J Jorgen Andersson

    It is indeed. But you need to keep in mind that it is largely due to how the test is setup. Loading a large amount of data into a collection. That's not where EF or NHibernate excels. They are both defaulting to lazy loading the data. So if you mainly do CRUD you might not even notice that it's slower. I might add that my own mapper is even faster, but that's not an ORM.

    Wrong is evil and must be defeated. - Jeff Ello

    R Offline
    R Offline
    RickZeeland
    wrote on last edited by
    #65

    You are right, a lot depends on the method of testing, in this more recent test NHibernate really shines: DotNet Core vs. NHibernate vs. Dapper Smackdown! | Frank DeCaire[^]

    J 2 Replies Last reply
    0
    • R RickZeeland

      You are right, a lot depends on the method of testing, in this more recent test NHibernate really shines: DotNet Core vs. NHibernate vs. Dapper Smackdown! | Frank DeCaire[^]

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #66

      That specific test you can simply throw into the garbage. You really can't compare cached data with raw. And if he gets raw ado to be slower than any ORM, he doesn't know what he's doing. (most probably implicit conversions, GetValue instead of using the type specific Get, and using named Get instead of ordinal Get) Which he on the other hand has in common with a lot of people. :sigh: A quick check of the code confirms my suspicions. He returns datasets in his own homegrown "datalayer" that doesn't do anything the right way. :zzz:

      Wrong is evil and must be defeated. - Jeff Ello

      1 Reply Last reply
      0
      • R RickZeeland

        At work a colleague has started using NHibernate, an ORM (Object-relational mapping), before this we only used hand-coded SQL routines. I wonder if this is a good choice, we are using VS2017, mainly C# and PostgreSQL. The database is fairly simple, only about 20 tables, but speed and performance are important factors.

        M Offline
        M Offline
        Marc Greiner at home
        wrote on last edited by
        #67

        We use the eXpressPersistent Objects™ (XPO) DevExpress[^]. It can do all we need (and we require a lot...). XPO is very well documented and when you need support, DevExpress answers questions quickly with a solution. Most of the time you find an answer in the support center history. Under others, this ORM supports 12 RDBMS and can work even with totally broken DB designs, for example with 30 year old legacy tables...

        1 Reply Last reply
        0
        • R RickZeeland

          At work a colleague has started using NHibernate, an ORM (Object-relational mapping), before this we only used hand-coded SQL routines. I wonder if this is a good choice, we are using VS2017, mainly C# and PostgreSQL. The database is fairly simple, only about 20 tables, but speed and performance are important factors.

          M Offline
          M Offline
          MadMyche
          wrote on last edited by
          #68

          >Speed and performance are important factors IMHO: - 1: Generally allow for speedier development for developers so they appear to have higher performance. - 2: "Raw" SQL generally is speedier allowing the allowing the program to achieve higher performance.


          Director of Transmogrification Services Shinobi of Query Language Master of Yoda Conditional

          R 1 Reply Last reply
          0
          • M MadMyche

            >Speed and performance are important factors IMHO: - 1: Generally allow for speedier development for developers so they appear to have higher performance. - 2: "Raw" SQL generally is speedier allowing the allowing the program to achieve higher performance.


            Director of Transmogrification Services Shinobi of Query Language Master of Yoda Conditional

            R Offline
            R Offline
            RickZeeland
            wrote on last edited by
            #69

            Thanks, that seems correct to me, the more I read about NHibernate the more confusing it gets, so I'm not convinced that it is a good solution for us. My first impressions are not positive I have to admit, the learning curve seems steep. But management has decided that we will give it a go, so we will see how far we get with it ...

            1 Reply Last reply
            0
            • R RickZeeland

              You are right, a lot depends on the method of testing, in this more recent test NHibernate really shines: DotNet Core vs. NHibernate vs. Dapper Smackdown! | Frank DeCaire[^]

              J Offline
              J Offline
              Jorgen Andersson
              wrote on last edited by
              #70

              So I tested his code (with a different database though) and compared with my own (creating POCOs instead of a dataset) and it becomes a bit more than twice as fast, which is also the speed indicated by dapper.

              Wrong is evil and must be defeated. - Jeff Ello

              R 1 Reply Last reply
              0
              • J Jorgen Andersson

                So I tested his code (with a different database though) and compared with my own (creating POCOs instead of a dataset) and it becomes a bit more than twice as fast, which is also the speed indicated by dapper.

                Wrong is evil and must be defeated. - Jeff Ello

                R Offline
                R Offline
                RickZeeland
                wrote on last edited by
                #71

                Thanks, you really seem to enjoy this :) But I'm afraid management has decided to go on with NHibernate, not my decision of course. We will see how far we get with it ... X|

                J 1 Reply Last reply
                0
                • R RickZeeland

                  Thanks, you really seem to enjoy this :) But I'm afraid management has decided to go on with NHibernate, not my decision of course. We will see how far we get with it ... X|

                  J Offline
                  J Offline
                  Jorgen Andersson
                  wrote on last edited by
                  #72

                  I cheated though, I could only be bothered to check the selects.

                  RickZeeland wrote:

                  Thanks, you really seem to enjoy this

                  What can I say, I'm a performance freak. ;P As you can see from my own mapper[^]. If you can find anything faster, that isn't pure ADO, I want a link to it.

                  RickZeeland wrote:

                  But I'm afraid management has decided to go on with NHibernate, not my decision of course.

                  Just don't sit around complaining, let them dig their own hole instead.

                  Wrong is evil and must be defeated. - Jeff Ello

                  R 1 Reply Last reply
                  0
                  • J Jorgen Andersson

                    I cheated though, I could only be bothered to check the selects.

                    RickZeeland wrote:

                    Thanks, you really seem to enjoy this

                    What can I say, I'm a performance freak. ;P As you can see from my own mapper[^]. If you can find anything faster, that isn't pure ADO, I want a link to it.

                    RickZeeland wrote:

                    But I'm afraid management has decided to go on with NHibernate, not my decision of course.

                    Just don't sit around complaining, let them dig their own hole instead.

                    Wrong is evil and must be defeated. - Jeff Ello

                    R Offline
                    R Offline
                    RickZeeland
                    wrote on last edited by
                    #73

                    Bookmarked your mapper :-\

                    J 1 Reply Last reply
                    0
                    • R RickZeeland

                      Bookmarked your mapper :-\

                      J Offline
                      J Offline
                      Jorgen Andersson
                      wrote on last edited by
                      #74

                      It's made to be used with this[^]. :-\ I should update that one though, I've enhanced it a bit since I made it.

                      Wrong is evil and must be defeated. - Jeff Ello

                      1 Reply Last reply
                      0
                      • R RickZeeland

                        At work a colleague has started using NHibernate, an ORM (Object-relational mapping), before this we only used hand-coded SQL routines. I wonder if this is a good choice, we are using VS2017, mainly C# and PostgreSQL. The database is fairly simple, only about 20 tables, but speed and performance are important factors.

                        E Offline
                        E Offline
                        Eric Whitmore
                        wrote on last edited by
                        #75

                        We use a tech stack that includes NHibernate in our enterprise environment and rarely have issues. It helps with TDD. I would suggest pairing it with a good IoC Container (like AutoFac) though. Side note, you can run raw SQL, HQL or execute stored procedures from NHibernate. Here is our server side stack: C# (WebApi) AutoFac (IoC Container) Fluent NHibernate (ORM Tool) MsTest (Testing Framework) Sqlite - InMemory Database configuration (Used in unit testing) MSSQL Server - Production NHiberante ASP.NET Identity OAUTH/OWIN Middleware Implementation Client Side: Twitter Boostrap (Front-end framework HTML framework) Typescript (Staticly typed, Class-based Transcompiler to JavaScript) AngularJS (MV* Framework) UI Bootstrap (Bootstrap components written in AngularJS) Font Awesome (Icon Framework) Jasmine (Javascript/Typescript Testing Framework)

                        Eric

                        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