Business Model Design
- 3 minutes to read
There are several different ways to design a Business Model in XAF. This topic will help you to choose what data access technology and modeling approach to use and provide you with basic information about XAF's Business Model design.
Data Access Technologies
XAF provides built-in support for the following external ORM tools that provide mapping between your coded or designed model and the database.
- eXpress Persistent Objects (XPO) by DevExpress (Documentation)
- Entity Framework 6 (EF6) by Microsoft (Documentation)
- Entity Framework Core by Microsoft (Documentation)
Currently, XAF does not support UI generation for the EF Core data model. Refer to the Security System for Entity Framework Core topic for more information.
To manipulate and display data that is not necessarily coming from ORM, you can use non-persistent objects.
Business Class is a model of a real-world object your application operate with (e.g., Contact, Address, Task, etc.). Each class that takes part in an XAF UI construction process is a business class. It can be a class mapped to a database table - Entity Framework Entity or XPO Persistent Object. Such classes are collected from your code, and UI elements are created for them automatically. If you do not need to persist an object state to the database, you can declare a regular class and apply the DomainComponentAttribute attribute to it - such a class will also take part in UI construction (see Non-Persistent Objects).
The information on Data Types for which XAF can automatically generate a UI is provided in the Data Types Supported by built-in Editors documentation section.
If the type you need to use can be displayed in the UI, but the ORM tool you use cannot store this type in the database, refer to the Mapping Complex Types to the Database article.
You can follow these workflows when creating a business classes.
Begin by implementing XPO persistent classes or EF entities that define your data model.
Begin with the designer. Draw boxes and lines in a designer provided by the chosen ORM tool to define objects and their relationships.
Programmers are often required to maintain a legacy database instead of building an application from scratch. Both XPO and EF can automatically generate a data model for a specified database. The created visual model or code can then be customized and extended as required.