I was wondering if this is possible in Linq:
I have three tables:
Request
--id
--Adress
--Description
Nav.Properties:
-- RequestStatus
RequestStatus
--RequestId
--PubDate
--StatusTypeId
Nav.Properties:
-- Request
-- StatusType
StatusType
--Id
--StatusTypeDescription
Nav.Properties
-- RequestStatus
In Linq, I can manage to get the first two table joined together with this:
var RequestWithStatus = dbContext.Requests.Include("RequestStatus").ToList<fullRequest>();
But…what I would like to have is the StatusTypeDescription column also included in this query (so use a join on a third table).
if a Request instance can have one RequestStatus, and a RequestStatus instance can have one StatusType, then you could simply do
there’s also a “lambda” (Expression>) overload for Include (in System.Data.Entity) (not sure it will work with mysql)
all your data will be present in the list (eager loading).
Then you can access Description
or safer