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. Dapper

Dapper

Scheduled Pinned Locked Moved The Lounge
question
47 Posts 22 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.
  • R realJSOP

    Does anyone here use the Dapper ORM?

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    S Offline
    S Offline
    stoneyowl2
    wrote on last edited by
    #29

    Not that one, but I have used something called 'PetaPoco', which is kinda based on Dapper. The nice thing, to me, is it is a single .cs file that can be included right in you solution. He also has a later version that is a normal assembly. You will probably need to google 'PetaPoco' to find it.

    C 1 Reply Last reply
    0
    • K Kent Sharkey

      I haven't used it, but I understand that there is an article in next month's MSDN Magazine about it (should be on the site on Monday). Julie Lerman (she of much EF writing) liked it.

      TTFN - Kent

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #30

      If Julie is s fan then that is a pretty big endorsement.

      veni bibi saltavi

      1 Reply Last reply
      0
      • R realJSOP

        Does anyone here use the Dapper ORM?

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        P Offline
        P Offline
        pt1401
        wrote on last edited by
        #31

        I've used it a lot. It's excellent, but in large projects its best used with some form of POCO-generator such as Codesmith to auto-generate your DAL classes on your build server. Dapper is very fast and, even more importantly IMO, it doesn't get in your way.

        1 Reply Last reply
        0
        • R realJSOP

          Does anyone here use the Dapper ORM?

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

          S Offline
          S Offline
          Ste S
          wrote on last edited by
          #32

          I've used Dapper a few times. I really like it and as others have said it generally gets out of the way and works well at mapping your sql to an object or collection of objects. I use it with Dapper extensions which makes simple selecting/updating etc pretty simple. I invested a lot of time in learning EF and it was hard to make the move but honestly I've never found a need to go back to using EF. EF seems overly complex, at least for my needs and I fail to see a good reason for using EF over a micro orm like Dapper or PetaPoco (which i also like).

          1 Reply Last reply
          0
          • R realJSOP

            C# is simply a copy of java, but without the cross-platform capabilities.

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #33

            I just finished a small project running ASP.NET 5 on a Docker container running Ubunutu hosted in Azure :rose: Exciting times ahead I think :)

            The whole thing's rigged to blow, touch those tanks and "boooom"!

            1 Reply Last reply
            0
            • R realJSOP

              Slacker007 wrote:

              Well, that is not really a good reason.

              It's always been a good reason in the past. And I like living in the past.

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #34

              What do you use instead of Visual Studio?

              The whole thing's rigged to blow, touch those tanks and "boooom"!

              R 1 Reply Last reply
              0
              • L Lost User

                What do you use instead of Visual Studio?

                The whole thing's rigged to blow, touch those tanks and "boooom"!

                R Offline
                R Offline
                realJSOP
                wrote on last edited by
                #35

                I use edlin to edit my code, and manually compile everything (yeah it takes a lot longer, but it's hella efficient code).

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                L 1 Reply Last reply
                0
                • R realJSOP

                  I use edlin to edit my code, and manually compile everything (yeah it takes a lot longer, but it's hella efficient code).

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #36

                  Wow, that looks like the hard way of doing things[^] :laugh: I guess you're paid by the hour? :laugh:

                  The whole thing's rigged to blow, touch those tanks and "boooom"!

                  R 1 Reply Last reply
                  0
                  • L Lost User

                    Wow, that looks like the hard way of doing things[^] :laugh: I guess you're paid by the hour? :laugh:

                    The whole thing's rigged to blow, touch those tanks and "boooom"!

                    R Offline
                    R Offline
                    realJSOP
                    wrote on last edited by
                    #37

                    Most things that are worth doing start out hard. And that's true for so many things in life. :)

                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                    -----
                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                    -----
                    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                    1 Reply Last reply
                    0
                    • D David Crow

                      Aren't .NET and Mono both from Microsoft, or are you targeting some other platform?

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                      R Offline
                      R Offline
                      realJSOP
                      wrote on last edited by
                      #38

                      I was just making a comment. I'm not targeting anything.

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                      1 Reply Last reply
                      0
                      • R realJSOP

                        Does anyone here use the Dapper ORM?

                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                        -----
                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                        -----
                        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                        M Offline
                        M Offline
                        Mark Jerzykowski
                        wrote on last edited by
                        #39

                        I use it. We wrote a slightly bigger ORM thing to go on top of it: Dashing[^] And yes, much time was spent on the name.

                        1 Reply Last reply
                        0
                        • S Slacker007

                          I have heard of Dapper, and that is about all. I have the most experience with EF but I am not going on the record to say that it is the best. I'm sure there are applications best suited for Dapper. I found this to be interesting. The conclusion at the end is the most important. Dapper looks to be faster in a lot of respects. Interesting. Don't Panic Labs – Speed Comparison: Dapper vs Entity Framework[^] Looks like Stackoverflow uses Dapper.

                          A Offline
                          A Offline
                          andegre
                          wrote on last edited by
                          #40

                          Dapper is considerably faster than EF. And I also believe that it was written BY Stackoverflow. GitHub - StackExchange/dapper-dot-net: Dapper - a simple object mapper for .Net[^]

                          S 1 Reply Last reply
                          0
                          • N Nish Nishant

                            Dapper is written in C# which is from Microsoft too :-)

                            Regards, Nish


                            Website: www.voidnish.com Blog: voidnish.wordpress.com

                            S Offline
                            S Offline
                            Snorri Kristjansson
                            wrote on last edited by
                            #41

                            He he - there is no escaping - is there?

                            1 Reply Last reply
                            0
                            • R realJSOP

                              Does anyone here use the Dapper ORM?

                              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                              -----
                              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                              -----
                              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                              C Offline
                              C Offline
                              Caspian Canuck
                              wrote on last edited by
                              #42

                              I've been using Dapper's spinoff NPoco for a couple of years in a large work project and it's worked out mostly great. The good: 1. Lightning fast, just a fraction slower than bare-bones ADO.NET. 2. No surprise SQL, you know exactly what SQL is sent to the server because you wrote it yourself (unless it's a simple single-table CRUD operation that NPoco generates itself). 3. Latest versions come with Linq expressions support. Back when our project got started there was no Linq support in NPoco and I ended up writing my own Linq-like repository wrapper. (I've made several other customizations to NPoco not all of which have made it into the official codebase, so I can't upgrade.) The bad: 1. No support for the JOIN syntax in NPoco's Linq implementation. Depending on how you look at it, this can be either a deficiency or a blessing (given how ugly SQL can get with auto-generated joins in EF and other full-feature ORMs). 2. The API can be a little confusing with too many overloaded methods and methods with different names but similar functionality.

                              1 Reply Last reply
                              0
                              • S stoneyowl2

                                Not that one, but I have used something called 'PetaPoco', which is kinda based on Dapper. The nice thing, to me, is it is a single .cs file that can be included right in you solution. He also has a later version that is a normal assembly. You will probably need to google 'PetaPoco' to find it.

                                C Offline
                                C Offline
                                Caspian Canuck
                                wrote on last edited by
                                #43

                                NPoco is the latest version of PetaPoco and is still being actively maintained.

                                1 Reply Last reply
                                0
                                • A andegre

                                  Dapper is considerably faster than EF. And I also believe that it was written BY Stackoverflow. GitHub - StackExchange/dapper-dot-net: Dapper - a simple object mapper for .Net[^]

                                  S Offline
                                  S Offline
                                  Slacker007
                                  wrote on last edited by
                                  #44

                                  andegre wrote:

                                  BY Stackoverflow.

                                  I see that. Interesting. Thanks for the info.

                                  1 Reply Last reply
                                  0
                                  • S Slacker007

                                    EF 6 has more optimizations than before, and is more powerful IMHO then 4 or 5. Any reason why you can't use that?

                                    U Offline
                                    U Offline
                                    UstesGreenridge
                                    wrote on last edited by
                                    #45

                                    The biggest reason I use Dapper, sometimes I just want to create some POCOs and have them access the db. With Dapper all I need is a connection string and my classes..

                                    1 Reply Last reply
                                    0
                                    • R realJSOP

                                      Does anyone here use the Dapper ORM?

                                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                      -----
                                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                      -----
                                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                                      J Offline
                                      J Offline
                                      James VT
                                      wrote on last edited by
                                      #46

                                      I used it for a project. I didn't use any of the object-relational mapping, but I liked that I could swap this:

                                      SqlConnection conn = new SqlConnection(connString);
                                      string sql = @"select * from MyTable";
                                      SqlCommand cmd = new SqlCommand(sql, conn);
                                      conn.Open();
                                      SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                                      if (rdr.HasRows)
                                      {
                                      while (rdr.Read())
                                      {
                                      //do something with record
                                      }
                                      rdr.Close();
                                      }

                                      with this:

                                      SqlConnection conn = new SqlConnection(connString);
                                      string sql = @"select * from MyTable";
                                      IEnumerable flatResult = conn.Query(sql);

                                      I thought that was pretty handy, especially for quick prototyping where the table and field names were changing a lot and I didn't want to hassle with altering all the field names and just wanted a quick resultset back.

                                      S 1 Reply Last reply
                                      0
                                      • J James VT

                                        I used it for a project. I didn't use any of the object-relational mapping, but I liked that I could swap this:

                                        SqlConnection conn = new SqlConnection(connString);
                                        string sql = @"select * from MyTable";
                                        SqlCommand cmd = new SqlCommand(sql, conn);
                                        conn.Open();
                                        SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                                        if (rdr.HasRows)
                                        {
                                        while (rdr.Read())
                                        {
                                        //do something with record
                                        }
                                        rdr.Close();
                                        }

                                        with this:

                                        SqlConnection conn = new SqlConnection(connString);
                                        string sql = @"select * from MyTable";
                                        IEnumerable flatResult = conn.Query(sql);

                                        I thought that was pretty handy, especially for quick prototyping where the table and field names were changing a lot and I didn't want to hassle with altering all the field names and just wanted a quick resultset back.

                                        S Offline
                                        S Offline
                                        Slacker007
                                        wrote on last edited by
                                        #47

                                        Inline SQL for anything (C# code files, etc.) is strongly discouraged at our shop, but I see your point. :)

                                        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