以下代码是SQL Server 2014中的SQL select查询,我想在C#中将其用作LINQ查询...请帮助我在LINQ中是新手。谢谢
USE [Proforecast]
GO
SELECT TooltipsLanguage.Id, TooltipsLanguage.Language,
TooltipsLanguageSection.Id, TooltipsLanguageSection.IdLanguage, TooltipsLanguageSection.IdSection,
TooltipsSection.Id, TooltipsSection.Section,
TooltipsItem.Id, TooltipsItem.IdSection, TooltipsItem.ItemName,
TooltipsItemText.Id, TooltipsItemText.IdItem, TooltipsItemText.IdText,
TooltipsText.Id, TooltipsText.Texts
FROM TooltipsLanguage
INNER JOIN TooltipsLanguageSection ON TooltipsLanguageSection.IdLanguage = TooltipsLanguage.Id
INNER JOIN TooltipsSection ON TooltipsSection.Id = TooltipsLanguageSection.IdSection
INNER JOIN TooltipsItem ON TooltipsItem.IdSection = TooltipsSection.Id
INNER JOIN TooltipsItemText ON TooltipsItemText.IdItem = TooltipsItem.Id
INNER JOIN TooltipsText ON TooltipsText.Id = TooltipsItemText.IdText
GO
答案 0 :(得分:0)
你是否尝试过这样的事情(为简洁起见省略了一些连接):
var result = from s in TooltipsLanguage
join c in TooltipsLanguageSection on s.Id equals c.IdLanguage
join p in TooltipsSection on c.IdSection equals p.Id
join ...
select new MyDestinationObject()
{
Id = s.BusinessEntityID,
Language = s.Language,
IdLanguage = c.IdLanguage,
...
};
答案 1 :(得分:0)
这可能会帮助你。
var temp= edbContext.TooltipsLanguage.select(
c=> new {
TooltipsLanguage.Id,
TooltipsLanguage.Language,
TooltipsLanguage.TooltipsLanguageSection.Id,
TooltipsLanguage.TooltipsLanguageSection.IdLanguage,
TooltipsLanguage.TooltipsLanguageSection.IdSection,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Id,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.Id,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.IdItem,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.TooltipsItemText.Id,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.TooltipsItemText.IdItem,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.TooltipsItemText.IdText,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.TooltipsItemText.TooltipsText.Id,
TooltipsLanguage.TooltipsLanguageSection.TooltipsSection.Section.TooltipsItem.TooltipsItemText.TooltipsText.Texts});