我有以下LINQ语句,我需要写内部,if子句,我做了以下但显然是一个错误,我问我怎样才能在LINQ中实现这样的东西?
var devices = (from c in db.MasterDatas
join m in db.TurbineDevices on
c.turbine_id equals m.turbine_ip
join t in db.v_vpn_gateway_info
on m.turbine_ip equals t.turbine_id
where m.turbine_ip == id
select new TurbineDvce
{
if(t.vpn_gateway==m.device_ip)
{Comments =vpn_gateway
}else
Comments = m.comments,
Description = m.description,
DeviceIP = m.device_ip,
DeviceType = m.device_type,
FirmwareVersion = m.firmware_version,
Model = m.model,
Password = m.psw,
Phone = m.tel_number,
Producer = m.producer,
PublicIP = m.public_ip,
TurbineId = m.turbine_ip,
Username = m.username
});