Search code examples
c#sqlselectlinq-to-entitiesinner-join

How to write the below SQL query to LINQ query in C#?


How to convert normal SQL to LINQ query? Is there tools that can do that?? Online Tools


Solution

  • Have you tried something like this (a few joins omitted for brevity):

    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,
                                      ...
                                  };