Back to Devexpress

Implement Reference Properties

expressappframework-402978-getting-started-in-depth-tutorial-blazor-define-data-model-and-set-initial-data-define-data-model-and-set-initial-data-with-ef-core-implement-reference-properties-ef-core.md

latest2.3 KB
Original Source

Implement Reference Properties

  • Jun 26, 2025
  • 3 minutes to read

This lesson explains the following concepts:

  • How to implement object references to existing classes.
  • How XAF generates a UI for referenced classes.

Note

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

Step-by-Step Instructions

  1. In the MySolution.Module\Business Objects folder, create the Position class. Replace the generated class declaration with the following code:

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

  3. Add the Position property to the Employee class:

  4. Run the application.

  5. Create Developer and Manager positions. They now appear in the Position List View:

  6. Open the Employee Detail View. In this view, XAF creates a lookup editor for the Position reference property.

Exercise: Add an “Address” Reference Property

  1. Use the same steps to add an Address reference property to the Employee entity. You can find the type declaration in the code sample below.

  2. Run the application and open the Employee Detail View. It should now contain the Address field:

Next Lesson

Initialize Entity Properties

See Also

Business Classes vs Database Tables

Built-in Business Classes & Interfaces

Ways to Add a Business Class

Data Annotation Attributes