I have a SQL query that uses cross apply to join to a table-valued function to a table as in the following in order to search what is essentially a linked list (parent and child work orders) for the first item.
select w.id newid, nod.id
from workorder
inner join entity woe on w.id = woe.id
cross apply NODWorkorder(w.id) nod
where woe.entity = 'aguid'
NODWorkorder returns a WORKORDER row that is the original parent work order. All ids are defined as varchar.
How would I convert this to LINQ? I am using EF Core 8.
I was able to import the TVF into the model as a WORKORDER type (using database first and EF Core Power Tools extension), but I can't figure out how to give the TVF the work order id from the work order table.
nodworkorders = (from wo in wdc.WORKORDERs
join woe in wdc.entity on wo.ID equals woe.ID
join NODs in wdc.NODWorkorder(wo.id) on wo.ID equals NODs.ID
select wo).ToList();
The code shown here doesn't recognize wo.id as a parameter to NODWorkorder.