-1
私はこのコードをlinqクエリに翻訳するのを手伝ってください。linqクエリに翻訳
SELECT DISTINCT dbo.Port.PortId, dbo.Port.Name
FROM dbo.Port INNER JOIN
dbo.Charge ON dbo.Port.PortId = dbo.Charge.PortId
私はこのコードをlinqクエリに翻訳するのを手伝ってください。linqクエリに翻訳
SELECT DISTINCT dbo.Port.PortId, dbo.Port.Name
FROM dbo.Port INNER JOIN
dbo.Charge ON dbo.Port.PortId = dbo.Charge.PortId
この
var q = (from tbl in yourContext.Port
join tbl1 in yourContext.Charge on tbl.PortId = tbl1.PortId
select tbl).Distinct().ToList();
または(ラムダ形式で)これを試してみてくださいようにしてみてください。
var query = youContext.Port //left table - outer
.Join (youContext.Charge, //right table - inner
p => p.PortId, //left table outer key selector
c => c.PortId, //right table inner key selector
(x, y) => new {x}) //result of join
.Select(x => new {x.PortId,
x.Name}) //finish selection
.Distinct(); //remove re-entry