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. C#
  4. LINQ to Entities

LINQ to Entities

Scheduled Pinned Locked Moved C#
csharpdatabaselinqperformancequestion
22 Posts 8 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.
  • P PIEBALDconsult

    Until you've fully explored enough of the wrong ways, you'll never truly appreciate the right way. :-D

    P Offline
    P Offline
    Pete OHanlon
    wrote on last edited by
    #12

    You missed the word "grasshopper" from the end of that sentence.

    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

    Forgive your enemies - it messes with their heads

    My blog | My articles | MoXAML PowerToys | Onyx

    1 Reply Last reply
    0
    • P PIEBALDconsult

      And what do you think it's doing in the background?

      musefan wrote:

      it can save a lot of time

      Coding time, yes. Maybe not execution time (have you benchmarked it?). Maybe not maintenance time if the next person to touch the code doesn't understand it. I'll stick with simpler code.

      R Offline
      R Offline
      Rob Philpott
      wrote on last edited by
      #13

      Good point. LINQ is usually slower when I've dabbled with it. And although more verbose I always prefer simple explicit code, less error prone, easier for others to understand and easier to debug.

      Regards, Rob Philpott.

      1 Reply Last reply
      0
      • T Tamimi Code

        do you really use it ? why i need to learn new syntax to get lower performance ? when i have no time and the high performance is not a must i go for the Dataset. its ok with the collections and arrays but with the database !! what do you think ? regardless that i am late to ask this :D

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #14

        I'm only just starting to learn LINQ: I have pretty reasonable SQL abilities already. The main reason I am learning it is that I feel that the stronger typing and compile time syntax checking available in LINQ to SQL has got to produce better, cleaner, more reliable solutions than hand crafted SQL. Once I've got a good feeling for it, I'll make the decision to either go with it or back - but until I have that level of confidence in my abilities with it, I can't make that call. If I don't learn LINQ, I made that call without sufficient information.

        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        P 1 Reply Last reply
        0
        • T Tamimi Code

          do you really use it ? why i need to learn new syntax to get lower performance ? when i have no time and the high performance is not a must i go for the Dataset. its ok with the collections and arrays but with the database !! what do you think ? regardless that i am late to ask this :D

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #15

          Perhaps you could look here for some information Entity Framework Performance[^]


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • P PIEBALDconsult

            And what do you think it's doing in the background?

            musefan wrote:

            it can save a lot of time

            Coding time, yes. Maybe not execution time (have you benchmarked it?). Maybe not maintenance time if the next person to touch the code doesn't understand it. I'll stick with simpler code.

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #16

            PIEBALDconsult wrote:

            have you benchmarked it?

            Yes, I have. Entity Framework Performance[^]


            I know the language. I've read a book. - _Madmatt

            1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              I'm only just starting to learn LINQ: I have pretty reasonable SQL abilities already. The main reason I am learning it is that I feel that the stronger typing and compile time syntax checking available in LINQ to SQL has got to produce better, cleaner, more reliable solutions than hand crafted SQL. Once I've got a good feeling for it, I'll make the decision to either go with it or back - but until I have that level of confidence in my abilities with it, I can't make that call. If I don't learn LINQ, I made that call without sufficient information.

              Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #17

              OriginalGriff wrote:

              If I don't learn LINQ, I made that call without sufficient information.

              Hear hear! I finally dabbled in a little bit of Linq (to SQL?) a few weeks ago. It gave me no benefit and I don't see how it can deliver any. Especially considering I use several different database systems, not just Sql Server.

              OriginalGriff wrote:

              LINQ to SQL has got to produce better, cleaner, more reliable solutions than hand crafted SQL.

              Not if you've been hand crafting clean reliable SQL for twenty years. If Linq produces better SQL than you do, then go with it.

              OriginalGriffO 1 Reply Last reply
              0
              • P PIEBALDconsult

                OriginalGriff wrote:

                If I don't learn LINQ, I made that call without sufficient information.

                Hear hear! I finally dabbled in a little bit of Linq (to SQL?) a few weeks ago. It gave me no benefit and I don't see how it can deliver any. Especially considering I use several different database systems, not just Sql Server.

                OriginalGriff wrote:

                LINQ to SQL has got to produce better, cleaner, more reliable solutions than hand crafted SQL.

                Not if you've been hand crafting clean reliable SQL for twenty years. If Linq produces better SQL than you do, then go with it.

                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #18

                PIEBALDconsult wrote:

                Not if you've been hand crafting clean reliable SQL for twenty years.

                Not quite what I meant: I was thinking more that finger trouble with LINQ is more likely to cause a compilation error, where in SQL it is run time and so harder to test and detect.

                Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                P 1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  PIEBALDconsult wrote:

                  Not if you've been hand crafting clean reliable SQL for twenty years.

                  Not quite what I meant: I was thinking more that finger trouble with LINQ is more likely to cause a compilation error, where in SQL it is run time and so harder to test and detect.

                  Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #19

                  Oh, sure, but you can develop and test your more-complex SQL statements with another tool and then copy-and-paste them into your application. An additional benefit of that is that it drives parameter use rather than concatenation.

                  OriginalGriffO 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Oh, sure, but you can develop and test your more-complex SQL statements with another tool and then copy-and-paste them into your application. An additional benefit of that is that it drives parameter use rather than concatenation.

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #20

                    I would assume that Linq generates parametrized queries anyway: I always use them with SQL. :-D

                    Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    P 1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      I would assume that Linq generates parametrized queries anyway: I always use them with SQL. :-D

                      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #21

                      OriginalGriff wrote:

                      I always use them with SQL

                      Yes, but others don't, because concatenation is easier unless your framework (e.g. Linq) makes parameters easier.

                      OriginalGriffO 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        OriginalGriff wrote:

                        I always use them with SQL

                        Yes, but others don't, because concatenation is easier unless your framework (e.g. Linq) makes parameters easier.

                        OriginalGriffO Offline
                        OriginalGriffO Offline
                        OriginalGriff
                        wrote on last edited by
                        #22

                        PIEBALDconsult wrote:

                        Yes, but others don't, because concatenation is easier they are lazy idiots who like leaving their DB wide open to an SQL injection attack

                        FTFY! :laugh:

                        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                        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