Open Closed

ABP Studio: Missing Navigation Property in Master Entity When Creating a Child Entity’s Child Entity #8931


User avatar
0
digitalservicegb created

Hello,

When I creating a Child Entity’s Child Entity in ABP Studio, I can select another Child Entity as the Master Entity for the new table. However, after clicking Save and Generation, the generated code throws an error.

The issue is that the generated Master Entity .cs file does not include a navigation property for the newly created table. As a result, when establishing the one-to-many relationship in DbContext, it fails due to the missing reference.

To resolve this, I have to manually add the navigation property in the Master Entity's extended file.

My question is:
Does ABP Studio not support creating a Child Entity’s Child Entity by default?
Or is there something I can do to prevent this issue from occurring?

  • I can select another Child Entity as the Master Entity for the new table.
    420300487-563ffeda-25d0-42ef-bfbf-176b29d454bd.png

  • The Master Entity’s .cs file does not include a navigation property for the new table.
    420297559-dc8c028d-6668-452b-88ad-2f8ca9fd2248.png

  • Causing DbContext to fail when establishing the one-to-many relationship.
    420296820-242a203e-e886-4f49-a997-d542f1b8c9e2.png

  • I need to manually add the navigation property in Master Entity's Extended file.
    420298365-d90d19ce-89be-4aa7-83b9-60982efea389.png


4 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    Thanks for your report, We'll check this case as soon as possible

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    Unfortunately I couldn't reproduce the exact same issue.

    image.png

    image.png

    Here some of questions to determine problem properly:

    • Which version of ABP Suite do you use? (Also your ABP version)

      • image.png

      • image.png

    • Did you add navigation manually in navigations tab? It should work without adding it

      • image.png

  • User Avatar
    0
    digitalservicegb created

    Hi,

    Unfortunately I couldn't reproduce the exact same issue.

    image.png

    image.png

    Here some of questions to determine problem properly:

    • Which version of ABP Suite do you use? (Also your ABP version)

      • image.png

      • image.png

    • Did you add navigation manually in navigations tab? It should work without adding it

      • image.png

    Hi

    My ABP Studio and ABP Versions

    • ABP Studio: 9.0.4

    • ABP Framework: 9.0.4
      image.png
      image.png

    My Case

    I want to create a four-layer Master-Detail relationship.

    • Creating the second-layer entity was successful since it's a typical case in the ABP documentation.

    • However, when I tried to create the third-layer entity, the .cs file of the second-layer entity did not include a navigation property for the new table.

    • In this case, the third-layer entity's master entity is the second-layer entity, while the second-layer entity is also a child entity itself.

    Manually Adding Navigation in the Navigations Tab
    I tried to manually add the navigation property in the Navigations tab, but it showed an error message:
    "The master entity can not be same with the navigation property."
    image.png

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    I delivered your report to the ABP Suite team currently,

    They'll investigate and fix it.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08