如何将此 SQL 查询转换为 Entityframework 查询
SELECT DISTINCT
EP.PrescriptionID
FROM dbo.tEPPrescriptions EP
WHERE EP.CustomerID = 22
OR ( EP.CustomerID IN (
SELECT DISTINCT
AP.CustomerID
FROM dbo.tEPAdditionalPrescribers AP
INNER JOIN dbo.tAddresses A ON AP.SupervisorID = A.CustomerID
WHERE AP.SupervisorID = 22
AND AP.ActiveFlag = 1 )
AND EP.LocationID IN (
SELECT DISTINCT
AP.LocationID
FROM dbo.tEPAdditionalPrescribers AP
INNER JOIN dbo.tAddresses A ON AP.SupervisorID = A.CustomerID
WHERE AP.SupervisorID = 22
AND AP.ActiveFlag = 1 )
)