有人可以帮我将以下SQL查询转换为LINQ格式吗?

SELECT a.ID,
       a.HostID,
       h.URL,
       a.SourceURL,
       a.TargetURL,
       c.Value,
       a.ExtFlag
FROM Link a
INNER JOIN Host h
ON h.ID = a.HostID
INNER JOIN Ref c
ON a.ResponseCode = c.SubType
AND c.Type = 'HTTP Status'

非常感谢

最佳答案

我认为应该是这样的:

var result = from a in Context.DGApprovedLink
             join h in Context.DGHost on a.HostID equals h.ID
             join c in Context.DGConfig on a.ResponseCode equals c.SubType
             where c.Type == "HTTP Status"
             select new {
                 a.ID,
                 a.HostID,
                 h.URL,
                 a.SourceURL,
                 a.TargetURL,
                 c.Value,
                 a.ExtFlag };

10-06 00:36