Base solution for your next web application
Open Closed

Deep in repository select #8094


User avatar
0
SASIMEXICO created

Hi,

I have a table with a 1..N relationship with herself. When I do a GetAllIncluding, it only gives me a one level of depth (ruleRepository.GetAllIncluding(x => x.Childs)), when the Childs has another Childs (4 levels of deep, relations). How can I do to give me all levels of depth?

Best Regards and thank you very much Toni


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team
    • What is your product version?
    • What is product framework type (.net framework or .net core)?

    If you are using EF Core. You can use IQueryable's Include and ThenInclude

    see https://docs.microsoft.com/en-us/ef/core/querying/related-data

  • User Avatar
    0
    SASIMEXICO created

    Hi,

    .net core + Angular version 4.9

    This table contain one-to-many relation with herself. Each record contain a ParentId and List of Childs

    I don't need Include and ThenInclude, I need in the same table, one register contain a child, this child have a parent and other child in the same time, this child contain a parent and child...

    when make -> var query = ruleRepository.GetAllIncluding(x => x.Childs, x => x.ListRuleValidators); Only one level of depth returns

    I hope that parent returns with his children and his children with his children... but those children (have other children) do not show them.

    Regards

  • User Avatar
    0
    maliming created
    Support Team

    hi SASIMEXICO

    Can you use Zero's Demo project to reproduce your situation and share it with me? [email protected] This way I can debug it locally.

    Or you can share your entity and configuration code so that I can reproduce it.

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.