请帮我在 LINQ-Enitites 中转换这个 SQL 查询
select e.RowMeterialName,f.RowUnitName,*,isnull((b.Quantity - (Select SUM(a.Quantity) from PurchaseDetail a
join PurchaseMaster c on a.PurchaseId=c.PurchaseId
where a.RawMetId=b.RawMetrialId and c.PurchaseOrderId=b.PurchaseOrderId)),b.Quantity) as Remain
from PurchaseOrderDetail b
join RawMeterialMaster e on b.RawMetrialId=e.RawMetId
join RawUnitMaster f on e.RawUnitId=f.RowUnitId
where b.PurchaseOrderId=@PurchaseOrderId
请帮我。