Back to Devexpress

Configure a Many-to-Many Relationship

expressappframework-402983-getting-started-in-depth-tutorial-blazor-define-data-model-and-set-initial-data-define-data-model-and-set-initial-data-with-ef-core-set-a-many-to-many-relationship-ef-core.md

latest1.8 KB
Original Source

Configure a Many-to-Many Relationship

  • Jun 26, 2025
  • 3 minutes to read

This lesson explains how to create a Many-to-Many relationship between two entities and how XAF generates the UI for such relationships.

Note

Before you proceed, take a moment to review the previous lessons:

Step-by-Step Instructions

  1. In the MySolution.Module\Business Objects folder, create the DemoTask class. Replace the generated class declaration with the code sample below:

  2. Add the Employees collection property to the DemoTask class. This way, you define the first part of the relationship between the DemoTask and Employee entities:

  3. Add the Tasks collection to the Employee class implementation:

  4. Go to the MySolution.Module\MySolutionDbContext file and add a DbSet of the Task type:

  5. Run the application.

Next Lesson

Implement Reference Properties

See Also

Data Annotation Attributes

Relationships Between Persistent Objects in Code and UI