Open pyramidsbuilder opened 4 years ago
Hello @leaditnet ,
For this kind of question, I recommend you to use instead Stack Overflow: https://stackoverflow.com/search?q=%5Bdynamic-linq%5Dleft+join&mixed=0
From one of these questions, I discovered this library: https://github.com/SikeyMael/LinqHelper which may help you to achieve what you want.
I am trying to get left outer join working with linq dynamic, The ideas I got is that I need to use group join with select many, So, I think I need to translate the following example to linq dynamic but I cannot get the syntax right: please help translating this linq code to Dynamic Linq
db.Categories .GroupJoin(db.Products, Category => Category.CategoryId, Product => Product.CategoryId, (x, y) => new { Category = x, Products = y }) .SelectMany( xy => xy.Products.DefaultIfEmpty(), (x, y) => new { Category = x.Category, Product = y }) .Select(s => new { CategoryName = s.Category.Name, ProductName = s.Product.Name });
Thanks