Skip to content

How to include nested EF entities in include #652

Closed
@guillemsola

Description

@guillemsola

Description

I'm using AutoMapper as I expose through a Resource information that I take from several classes that require EF navigation. See src.EntityTypeNameType.NameType.Code in the mapping that I use..

 CreateMap<Model.EntityName, DTO.EntityName>()
    .ForMember(dest => dest.NameType,
        opts => opts.MapFrom(src => src.EntityTypeNameType.NameType.Code));

What happens is that with the DefaultEntityRepository I see only the base include is included unless I force it.

My idea is to override the IQueryable<Entity> Include(...) and create a Dictionary of the nested includes required that need to be loaded to query all the tables in the relationship.

This is more a design question or feature-request rather than a bug. Does it make sense the solution I'm planning?

btw, congrats for this project looks very nice! ;)

Environment

  • JsonApiDotNetCore Version: v3.1.0
  • Other Relevant Package Versions: AutoMapper

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions