Built-in Business Classes & Interfaces
- 4 minutes to read
The XAF features the Business Class Library with interfaces for XAF modules and the interface implementations for supported ORMs (XPO and EF Core).
The Business Class Library consists of the following assemblies:
- DevExpress.Persistent.BaseImpl.Xpo.v24.2.dll
- Contains ready-to-use XPO persistent classes.
- DevExpress.Persistent.BaseImpl.EFCore.v24.2.dll
- Contains ready-to-use Entity Framework Core classes.
- DevExpress.Persistent.Base.v24.2.dll
- Contains interfaces and helper classes used in XAF Additional Modules. Classes implementing these interfaces are available in the DevExpress.Persistent.BaseImpl.* assemblies listed above.
#Demo Classes for Most Popular Scenarios
The DevExpress.Persistent.BaseImpl
namespace (inside the DevExpress.Persistent.BaseImpl.Xpo.v24.2.dll and DevExpress.Persistent.BaseImpl.EFCore.v24.2.dll libraries) includes business classes useful for our demos and tutorials. For instance, Person
, Address
, Organization
, PhoneNumber
, Task
, and so on. We do not recommend that you reuse these demo classes in your applications as is, or derive and extend them. Use our implementations for inspiration to create your own classes.
You can still use XAF module-specific or service business classes that implement XAF module interfaces as is, like ReportDataV2
, FileData
, and DashboardData
.
#Interfaces for XAF Modules
Assembly: DevExpress.Persistent.Base.v24.2.dll
Use service interfaces from the DevExpress.Persistent.Base.v24.2.dll assembly to integrate your business classes to XAF modules like Security System.
Examples:
- Implement a Custom Security System User Based on an Existing Business Class
- Implement Custom Security Objects (Users, Roles, Operation Permissions)
- How to: Store file attachments in the file system instead of the database (XPO)
- Attach Files to Objects
- How to: Add a Custom Column to the Reports List
- Display a Tree List using the ITreeNode Interface
- Display a Tree List using the HCategory Class
- How to: Use Notifications with a Custom Business Class (Implement ISupportNotifications)
- Implement Custom Rules
#Interface Implementations for Supported ORMs
Assemblies:
- DevExpress.Persistent.BaseImpl.Xpo.v24.2.dll
- DevExpress.Persistent.BaseImpl.EFCore.v24.2.dll
The Business Class Library allows you to do the following:
- Use classes from the DevExpress.Persistent.BaseImpl***.24.2.dll assemblies.
- Extend persistent classes from the DevExpress.Persistent.BaseImpl***.24.2.dll assemblies to add custom functionality.
- Use the DevExpress.Persistent.BaseImpl***.24.2.dll assembly sources (shipped with the XAF installation) as an example when developing your own business class library.
- The Business Class Library assemblies do not have references to other XAF assemblies. This allows you to use services defined there (like validation, audit trail, etc.) in non-XAF applications.
To add a class from the Business Class Library to the UI construction process, use the ModuleBase.AdditionalExportedTypes property, or use the Exported Types section of the Module Designer.
Use the Business Class Library Customization Module to change the UI settings of the Business Class Library classes.
#Business Class Library Customization Module
The Business Class Library Customization module includes UI settings (Application Model differences) for XPO and Entity Framework Core classes from the Business Class Library. It specifies class icons, List View column arrangements, and Detail View layouts. To apply settings from this module, invoke the Application Designer and drag the BusinessClassLibraryCustomizationModule item from the toolbox to the Required Modules pane.
The Model Editor can override Business Class Library Customization module settings.
Note
You can add modules to your application when you use the Solution Wizard to create a new XAF solution. Select modules in the Choose Additional Modules step.
- To add an extra module in code, add it to the Xaf
Application. or ModuleModules Base. list (adding a reference to the module assembly is insufficient).Required Module Types
In .NET applications, you can call the Add
Business method in your ASP.Class Library Customization <TBuilder>(IModule Builder <TBuilder>) NET Core Blazor/Win Forms application builder.
#Create Custom Classes with Class Names that Business Class Library Contains
If your custom business classes are named the same way as classes from the Business Class Library (for example, Person, Address, Organization, PhoneNumber), you receive the following errors:
- DuplicateModelNodeIdException at runtime or in the Model Editor.
- View layout collisions in the Model Editor.
To avoid these errors, use the ModelNodesGeneratorSettings.SetIdPrefix method as follows:
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.DC;
using DevExpress.ExpressApp.Updating;
using DevExpress.ExpressApp.Model.NodeGenerators;
namespace MySolution.Module {
public sealed partial class SolutionNameModule : ModuleBase {
public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
base.CustomizeTypesInfo(typesInfo);
ModelNodesGeneratorSettings.SetIdPrefix(
typeof(MySolution.Module.BusinessObjects.Address),
"AddressEx"
);
}
}
}