C#C
C#2y ago
Raso

How do I do an inner GroupJoin on dotnet?

I'm using .NET 6 with Entity Framework. This is my situation: I have a BenefitEntity (with Name and Description properties and a relationship with BenefitCategory) and this BenefitCategory which has Name and Description as well.

In the application, all the Names and Descriptions are translated, we have a TranslationEntities table that contains all the translations.

Here are the three classes (I'll keep it simple and put just the properties we need):
C#
public class BenefitEntity
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public Guid BenefitCategoryId { get; set; }
    public virtual BenefitCategoryEntity CategoryEntity { get; set; }
}

public class BenefitCategoryEntity
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
}

public class TranslationEntity
{
    public Guid EntityId { get; set; }
    public string Language { get; set; }
    public string Property { get; set; }
    public string Value { get; set; }
}


The TranslationEntities table contains all the translations, for all the entities type. I want to get all the BenefitEntity, using the GroupJoin for their Name/Description and do another inner join for its BenefitCategory name and description. I'm able to do the first one, but not able to do the second one.
Was this page helpful?