我有以下型号:
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public int CategoryId{ get; set; }
}
public class Category
{
public int Id { get; set; }
public string Name { get; set; }
}
我正在尝试使用Products查询Category模型和group join:
var categoryList = (from c in session.Query<Category>()
join p in session.Query<Product>() on e.Id equals p.CategoryId into products
select new
{
Id = c.Id,
Name = c.Name,
products= products.Select(p => new
{
id = p.Id,
Name = p.Name
}).ToList()
}).ToList();
因此,我只有至少有一种产品(内部联接)的类别。如何使用Product执行左连接?