我正在尝试在 EF 中调用 SQL SCALAR 函数。我尝试了各种示例,但我不断收到:
无法将类型 y 上的指定方法 x 转换为 LINQ to Entities 存储表达式。
我在用...
英孚 6.1.3
EntityFramework.Functions 1.4.1
查询:
注意我在 SELECT 中调用它...
public IQueryable<MeterDataItem> Query()
{
var query = from meter in UnitOfWork.Meter
join meterType in UnitOfWork.MeterType on meter.MeterTypeId equals meterType.Id into meterTypeLEFTJOIN
from meterType in meterTypeLEFTJOIN.DefaultIfEmpty()
join company in UnitOfWork.Company on meter.CompanyId equals company.Id
join meterPosition in UnitOfWork.EFMMeterPosition on meter.EFMMeterPositionId equals meterPosition.Id into meterPositionLEFTJOIN
from meterPosition in meterPositionLEFTJOIN.DefaultIfEmpty()
join flowType in UnitOfWork.FlowType on meter.FlowTypeId equals flowType.Id into flowTypeLEFTJOIN
from flowType in flowTypeLEFTJOIN.DefaultIfEmpty()
join fluidType in UnitOfWork.FluidType on meter.FluidTypeId equals fluidType.Id into fluidTypeLEFTJOIN
from fluidType in fluidTypeLEFTJOIN.DefaultIfEmpty()
join runStatus in UnitOfWork.RunStatus on meter.RunStatusId equals runStatus.Id into runStatusLEFTJOIN
from runStatus in runStatusLEFTJOIN.DefaultIfEmpty()
join pipeline in UnitOfWork.Pipeline on meter.PipelineId equals pipeline.Id into pipelineLEFTJOIN
from pipeline in pipelineLEFTJOIN.DefaultIfEmpty()
// Device portion
join device in UnitOfWork.Device on meter.DeviceId equals device.Id into deviceLEFTJOIN
from device in deviceLEFTJOIN.DefaultIfEmpty()
join rtuDevice in UnitOfWork.RTUDevice on device.Id equals rtuDevice.DeviceId into rtuDeviceLEFTJOIN
from rtuDevice in rtuDeviceLEFTJOIN.DefaultIfEmpty()
相关分类