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. Why LINQ Sucks Today.

Why LINQ Sucks Today.

Scheduled Pinned Locked Moved The Lounge
csharplinq
16 Posts 6 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.
  • B Brady Kelly

    Natively it only has one 'join' operator, the equijoin, or inner join. A left or right join requires a subquery, and I don't want (today) to contemplate a full outer join.

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #5

    Brady Kelly wrote:

    Natively it only has one 'join' operator, the equijoin, or inner join.

    Nope, you just need to know how to do it. Tip: DefaultIfEmpty()

    xacc.ide
    IronScheme - 1.0 RC 1 - out now!
    ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

    B 1 Reply Last reply
    0
    • W wout de zeeuw

      Haven't played with linq at all yet, the one thing that scares me is that I can't quickly see what gets done by the DB and what gets bluntly loaded into the .NET world and filtered there.

      Wout

      B Offline
      B Offline
      Brady Kelly
      wrote on last edited by
      #6

      I don't know off-hand, but there is a readily accessible tool to reveal the DB query. Things like filtering definitely get delegated to the DB.

      1 Reply Last reply
      0
      • L leppie

        Brady Kelly wrote:

        Natively it only has one 'join' operator, the equijoin, or inner join.

        Nope, you just need to know how to do it. Tip: DefaultIfEmpty()

        xacc.ide
        IronScheme - 1.0 RC 1 - out now!
        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #7

        leppie wrote:

        Tip: DefaultIfEmpty()

        Not available in Entity Framework. I have been doing some homework. :)

        L 1 Reply Last reply
        0
        • B Brady Kelly

          leppie wrote:

          Tip: DefaultIfEmpty()

          Not available in Entity Framework. I have been doing some homework. :)

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #8

          There, I fixed the subject. Do not curse my precious Linq2SQL :)

          xacc.ide
          IronScheme - 1.0 RC 1 - out now!
          ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

          B 1 Reply Last reply
          0
          • L leppie

            There, I fixed the subject. Do not curse my precious Linq2SQL :)

            xacc.ide
            IronScheme - 1.0 RC 1 - out now!
            ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

            B Offline
            B Offline
            Brady Kelly
            wrote on last edited by
            #9

            Still, Linq2SQL doesn't have an outer join operator. Full stop.

            L 1 Reply Last reply
            0
            • B Brady Kelly

              Still, Linq2SQL doesn't have an outer join operator. Full stop.

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #10

              Brady Kelly wrote:

              Still, Linq2SQL doesn't have an outer join operator. Full stop.

              Yes, but I am sure with a little tweaking an OUTER JOIN can be emitted. To be honest, I dont even care about SQL syntax anymore, as long as LINQ spits out a minimum number of queries to get your data, then I am happy :) Sometimes to squeeze out the most, you will have to prepare some lookup queries ahead of time.

              xacc.ide
              IronScheme - 1.0 RC 1 - out now!
              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

              B 1 Reply Last reply
              0
              • L leppie

                Brady Kelly wrote:

                Still, Linq2SQL doesn't have an outer join operator. Full stop.

                Yes, but I am sure with a little tweaking an OUTER JOIN can be emitted. To be honest, I dont even care about SQL syntax anymore, as long as LINQ spits out a minimum number of queries to get your data, then I am happy :) Sometimes to squeeze out the most, you will have to prepare some lookup queries ahead of time.

                xacc.ide
                IronScheme - 1.0 RC 1 - out now!
                ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                B Offline
                B Offline
                Brady Kelly
                wrote on last edited by
                #11

                Seeing as this is a paying job, and I want to drink beer, I have opted for a SQL view to provide the left join. Pragmatism sub-queries FTW! :cool:

                L 1 Reply Last reply
                0
                • B Brady Kelly

                  Seeing as this is a paying job, and I want to drink beer, I have opted for a SQL view to provide the left join. Pragmatism sub-queries FTW! :cool:

                  L Offline
                  L Offline
                  leppie
                  wrote on last edited by
                  #12

                  Brady Kelly wrote:

                  I have opted for a SQL view to provide the left join.

                  You are lucky. Our whole DB has to stay SQLCE compatible, no views, SP's or functions.

                  xacc.ide
                  IronScheme - 1.0 RC 1 - out now!
                  ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                  B 1 Reply Last reply
                  0
                  • B Brady Kelly

                    Natively it only has one 'join' operator, the equijoin, or inner join. A left or right join requires a subquery, and I don't want (today) to contemplate a full outer join.

                    P Offline
                    P Offline
                    peterchen
                    wrote on last edited by
                    #13

                    Having to contemplate joins might be considered another negative aspect.

                    Personally, I love the idea that Raymond spends his nights posting bad regexs to mailing lists under the pseudonym of Jane Smith. He'd be like a super hero, only more nerdy and less useful. [Trevel]
                    | FoldWithUs! | sighist | µLaunch - program launcher for server core and hyper-v server

                    B 1 Reply Last reply
                    0
                    • L leppie

                      Brady Kelly wrote:

                      I have opted for a SQL view to provide the left join.

                      You are lucky. Our whole DB has to stay SQLCE compatible, no views, SP's or functions.

                      xacc.ide
                      IronScheme - 1.0 RC 1 - out now!
                      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                      B Offline
                      B Offline
                      Brady Kelly
                      wrote on last edited by
                      #14

                      Turns out I couldn't use a view, or only use an unnecessarily complex view, so I subquery the value lists for later aggregation.

                      1 Reply Last reply
                      0
                      • P peterchen

                        Having to contemplate joins might be considered another negative aspect.

                        Personally, I love the idea that Raymond spends his nights posting bad regexs to mailing lists under the pseudonym of Jane Smith. He'd be like a super hero, only more nerdy and less useful. [Trevel]
                        | FoldWithUs! | sighist | µLaunch - program launcher for server core and hyper-v server

                        B Offline
                        B Offline
                        Brady Kelly
                        wrote on last edited by
                        #15

                        So true.

                        1 Reply Last reply
                        0
                        • B Brady Kelly

                          Natively it only has one 'join' operator, the equijoin, or inner join. A left or right join requires a subquery, and I don't want (today) to contemplate a full outer join.

                          S Offline
                          S Offline
                          simonor
                          wrote on last edited by
                          #16

                          Yeah, but you've got to love that you can make your own IQueryable to fill in the gaps.

                          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