I have the following query:
var query =
from modules in _Context.Modules
join moduleStrings in _Context.ModuleStrings on modules.MID equals moduleStrings.MID
join strings in _Context.Strings on moduleStrings.SID equals strings.SID
join stringTexts in _Context.StringTexts on strings.SID equals stringTexts.SID into stringsEmpty
from stringTexts in stringsEmpty.DefaultIfEmpty()
join languages in _Context.Languages on stringTexts.LID equals languages.LID
where modules.MID == MID && LID == languages.LID
select new GridData6S()
{
Name = strings.Name,
Text = stringTexts != null ? stringTexts.Text : ""
};
I want to join it so that I see the empty text if stringTexts is null.
It’s probably some small thing, but I have been looking at this for an hour and can’t figure it out. This is the closest I got.
You are filtering out any language that is not LID=languages.LID so when languages/stringTexts are null this condition will never be true.
Also as the only reason you seem to be joining to the languages table is to get the LID which is also the join condition, you could just skip joining to languages
The same is true for modules…..
This might help and is a little simpler