Back to Devexpress

Initialize Entity Properties

expressappframework-402982-getting-started-in-depth-tutorial-blazor-define-data-model-and-set-initial-data-define-data-model-and-set-initial-data-with-ef-core-initialize-a-property-after-creating-an-object-ef-core.md

latest2.1 KB
Original Source

Initialize Entity Properties

  • May 07, 2025
  • 2 minutes to read

This lesson explains how to initialize properties in the newly created entity instances.

The steps below show how to add a Priority property to the DemoTask class and how to initialize the property value. For DemoTask class implementation code, see the following lesson: Set a Many-to-Many Relationship.

Note

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

Step-by-Step Instructions

  1. Add the Priority property to the DemoTask class and declare the Priority enumeration:

  2. Use the code below to initialize the newly added Priority property when you create a DemoTask object:

  3. Run the application.

Next Lesson

Implement Dependent Reference Properties

See Also

Business Classes vs Database Tables

Data Annotation Attributes

Initialize Business Objects with Default Property Values in XPO