Reputation: 1243
Here is my select in SQL:
select *
from FactorItems fi
inner join tblparts p on p.PartsID = fi.PartRef
So as I use *
to get all columns from my join.
But with this code:
var FactorItem = (from FI in context.FactorItems
join P in context.tblparts on FI.PartRef equals P.PartsID
where (FI.FactorRef == FactorID)
select FI);
I just get data which is in FI
. I want to get all data - so what code do I need for that?
Upvotes: 0
Views: 57
Reputation: 4627
you are returning only one entity, FI
. You need to return both the entities .. FI
and P
, like :
// your rest of query
select new { FI, P}
This way it should get you all the concerned data
Upvotes: 0
Reputation: 270
With that Linq to Sql code, you can return all data creating a new object:
var FactorItem = (from FI in context.FactorItems
join P in context.tblparts on FI.PartRef equals P.PartsID
where (FI.FactorRef == FactorID)
select new {FI,P};
Upvotes: 2