尝试了很多搜索中的各种组合,但似乎仍无法正常工作。我有以下查询:
var r = from a in ctx.DGApprovedLinks
join h in ctx.DGHosts on a.HostID equals h.ID
join c in ctx.DGConfigs on SqlFunctions.StringConvert((double)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
};
但未能返回任何结果。我在SQL事件探查器中得到以下内容:
SELECT
1 AS [C1],
[Extent1].[ID] AS [ID],
[Extent1].[HostID] AS [HostID],
[Extent2].[URL] AS [URL],
[Extent1].[SourceURL] AS [SourceURL],
[Extent1].[TargetURL] AS [TargetURL],
[Extent3].[Value] AS [Value],
[Extent1].[ExtFlag] AS [ExtFlag]
FROM [dbo].[DGApprovedLink] AS [Extent1]
INNER JOIN [dbo].[DGHost] AS [Extent2] ON [Extent1].[HostID] = [Extent2].[ID]
INNER JOIN [dbo].[DGConfig] AS [Extent3] ON ((STR( CAST( [Extent1].[ResponseCode] AS float))) = [Extent3].[SubType]) OR ((STR( CAST( [Extent1].[ResponseCode] AS float)) IS NULL) AND ([Extent3].[SubType] IS NULL))
WHERE N'HTTP Status' = [Extent3].[Type]
非常感谢任何帮助。