none
Linq To Entity - Additional Join breaks one column's content RRS feed

  • Question

  • Hoping this is the right place for a Linq To Entity question?

    We've got a Linq To Entity query that basically selects almost all columns from a From table / entities set (where some condition).

    There are also a few additional "lookup" fields from two other tables that are JOINed via foreign-key columns, and all that is working well.

    Now when I add a another Join pointing to a certain other table (without changing the "select new{column list}" part), the result still works well, no compiler or run-time errors, except that one among many columns from the From table becomes empty all of a sudden, i.e. contains Char(60) white-space only.
    So that if say the From table would be named "customers", then all result columns, customers.A, customers.B, customers.C and so on would still display the expected content, except one column, say customers.L between customers.K and customers.M

    As soon as I remove the additional Join, that column is having the expected content again.
    Additionally joining a different table instead of the misbehaving one works well.
    And in turn, when I join that particular "misbehaving" table in another query, that other query does not show the misbehavior.

    Does that sound like a familiar pattern or "known issue"?

    (FWIW, I pasted the working query before the additional Join below.
    The unexpectedly-empty column is "dab.ArtikelNummer".
    The additional Join mixing up one of the result columns would look like

                        join art in this.Context.ArtikelEntities
                            on dab.ID_Artikel equals art.ID
    

    and it would not matter whether it would be the first, second or third Join.)



    Thanks in advance

    -Stefan

                    var linqResult =
                        from dab in this.Context.DaBedarfsDatenEntities
                        join kun in this.Context.KundeEntities
                            on dab.ID_Kunde equals kun.ID
                        join dau in this.Context.DaUnitEntities
                            on dab.ID_MengenKennzeichen equals dau.ID
                        where dab.Datum >= dateBegin && dab.Datum <= dateEnd && dab.ID_Kunde == kundenID
                        select new
                        {
                            id = dab.ID,
                            id_sender = dab.ID_Sender,
                            id_kunde = dab.ID_Kunde,
                            id_liefer = dab.ID_Liefer,
                            id_artikel = dab.ID_Artikel,
                            id_mengenKennzeichen = dab.ID_MengenKennzeichen,
                            artikelNummer = dab.ArtikelNummer,
                            menge = dab.Menge,
                            datum = dab.Datum,
                            datum_bis = dab.Datum_bis,
                            bestellNummer = dab.BestellNummer,
                            bestellPosition = dab.BestellPosition,
                            bemerkung = dab.Bemerkung,
                            einleseDatum = dab.EinleseDatum,
                            status = dab.Status,
                            elkz = dab.ElKZ,
                            markiert = dab.Markiert,
                            typ = dab.Typ,
                            kundenAnlage = dab.kundenanlage,
                            kundenKW = dab.kundenKW,
                            transportNr = dab.transportNr,
                            artikelEanCode = dab.artikelEanCode,
                            bes1 = dab.bes1,
                            anzPal = dab.anzpal,
                            lfdNrKd = dab.lfdNrKd,
                            korrekturNr = dab.korrekturNr,
                            matNr = dab.matNr,
                            kundenName__ = kun.name1,
                            lieferOrt__ = lie.ort,
                            mengenKennzeichen__ = dau.Beschreibung
                        };
    



    • Moved by Annabella Luo Monday, July 16, 2012 5:05 AM (From:Windows Presentation Foundation (WPF))
    Wednesday, July 11, 2012 10:09 AM

All replies

  • Hi Stefan,

    This is not a WPF issue I think , you can ask data question on LINQ to SQL Forum

    Best regards.

    Friday, July 13, 2012 10:00 AM
  • Hi Hi Stefan,

    Thank you for your post. According to your desciption I understand your issue is about SQL Linq, so I'm moving your thread to  LINQ to SQL Forum so that you can get a better help.

    Thank you for your understanding and support.

    Have a nice day.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 16, 2012 4:52 AM
  • Hi Stefan,

    I'm afraid I couldn't repro the issue, if possible, could you please upload a demo project  to SkyDrive and post the link here? This is, so I can help you more effectively.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, July 17, 2012 5:43 AM
    Moderator
  • Thanks Allen!

    For what it's worth, the symptom disappeared as soon as I later modified some of the Joins from "inner" to "outer" (which I had to do anyway).

    Since the issue had been "disappearing" column content, as opposed to disappearing rows, I did not find an explanation though.
    However, as soon as I would get that one or a similar issue again, I'll surely try to create a demo.

    Thanks again
    -Stefan

    Tuesday, August 14, 2012 7:59 AM