This is a migrated thread and some comments may be shown as answers.
Outer Join
5 Answers 4 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nader
Top achievements
Rank 1
Nader asked on 26 Feb 2015, 04:57 AM
I must be missing something simple.  I'm trying to do a Left or Right Outer Join using LINQ but it doesn't seem to work with Data Access:

Dim myFields As IEnumerable(Of LibFieldNameValues) = (From c In dbContextLib.LibItemFields
                                                        Join d In dbContextLib.LibItemFieldOptions On c.ItemFieldID Equals d.ItemFieldID
                                                        Join q In dbContextItem.ItemDetails On d.ItemFieldOptionID Equals q.ItemFieldOptionID Into t
                                                        From q In t.DefaultIfEmpty()
                                                        Where d.CommodityID = CommodityID And q.ItemID = ItemID
                                                        Select New LibFieldNameValues With {.FieldName = c.FieldName,
                                                                                            .FieldValue = q.OptionValue})

It does not like the "Into" lines.

Any help would be appreciated. 

Thanks,
ND












5 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 02 Mar 2015, 07:38 AM
Hello ND,

without looking too deep into this I could imagine that the issue lies in the double usage of the q variable. Please rename the q in the Into line to something else and change the following projection accordingly. That should get you around this issue.

Regards,
Thomas
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Nader
Top achievements
Rank 1
answered on 19 Mar 2015, 11:43 PM
Dim tmp = (From c In dbContext.ISNs
Join d In dbContext.ISNShipments On c.IsnID Equals d.IsnID Into T
From G In T.DefaultIfEmpty()
Select G)

I must be doing something wrong.  Can this type of query even be done with Telerik Data Access?
0
Thomas
Telerik team
answered on 20 Mar 2015, 03:50 PM
Hi ND,

this query looks perfectly legal to me and should produce a left outer join.

Regards,
Thomas
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Nader
Top achievements
Rank 1
answered on 20 Mar 2015, 03:52 PM
For some reason Visual Studio doesn't like the:

Into T
From G In T.DefaultIfEmpty()

And it does not compile.
0
Thomas
Telerik team
answered on 24 Mar 2015, 04:35 PM
Hi Nader,


please use the correct VB syntax there:

...
Group Join q In Scope.Extent(Of Northwind.OrderDetail)() On d.Id Equals q.OrderID Into t = Group _
From G In t ...


Regards,
Thomas
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
LINQ (LINQ specific questions)
Asked by
Nader
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Nader
Top achievements
Rank 1
Share this question
or