Skip to main content

Built-in Business Classes & Interfaces

  • 5 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:

Assembly Description
DevExpress.Persistent.BaseImpl.Xpo.v24.1.dll Contains ready-to-use XPO persistent classes.
DevExpress.Persistent.BaseImpl.EFCore.v24.1.dll Contains ready-to-use Entity Framework Core classes.
DevExpress.Persistent.Base.v24.1.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.

Interfaces for XAF Modules

Assembly: DevExpress.Persistent.Base.v24.1.dll

Use service interfaces from the DevExpress.Persistent.Base.v24.1.dll assembly to integrate your business classes to XAF modules like Security System.

Examples:

Interface Implementations for Supported ORMs

Assemblies:

  • DevExpress.Persistent.BaseImpl.Xpo.v24.1.dll
  • DevExpress.Persistent.BaseImpl.EFCore.v24.1.dll

The Business Class Library allows you to do the following:

  • Use classes from the DevExpress.Persistent.BaseImpl***.24.1.dll assemblies.
  • Extend persistent classes from the DevExpress.Persistent.BaseImpl***.24.1.dll assemblies to add custom functionality.
  • Use the DevExpress.Persistent.BaseImpl***.24.1.dll assembly sources (shipped with the XAF installation) as an example when developing your own business class library. In addition, you can modify the sources and recompile this assembly if required. Source files are located at the following path: %PROGRAMFILES%\DevExpress 24.1\Components\Sources\DevExpress.Persistent\.
  • 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.

BusinessClassLibraryCustomizationModule

The Model Editor can override Business Class Library Customization module settings.

Note

Recompile the Business Class Library

You can modify and recompile an assembly with ready-to-use XPO or EF Core entities using the steps below.

  • Run the Visual Studio Command Prompt as an administrator and execute the Sn.exe (Strong Name Tool) utility with the following parameters:

    sn -k "%PROGRAMFILES%\DevExpress 24.1\Components\Sources\DevExpress.Key\StrongKey.snk"

    This will create the strong name file (see Strong-Named Assemblies).

  • Navigate to one of the following folders:

    • %PROGRAMFILES%\DevExpress 24.1\Components\Sources\DevExpress.Persistent\DevExpress.Persistent.BaseImpl.Xpo - if you use XPO.
    • %PROGRAMFILES%\DevExpress 24.1\Components\Sources\DevExpress.Persistent\DevExpress.Persistent.BaseImpl.EFCore - if you use EF Core.

    Open the DevExpress.Persistent.BaseImpl.csproj, DevExpress.Persistent.BaseImpl.EF.csproj, or DevExpress.Persistent.BaseImpl.EFCore.NetStandard.csproj project in Visual Studio.

  • If you use EF, ensure that the EntityFramework.dll assembly is available. You can download it from NuGet.

  • Modify any class from the opened project.
  • Compile the project by clicking Rebuild in the context menu invoked for the solution. Once this rebuild is successful, the default assembly located in the %PROGRAMFILES%\DevExpress 24.1\Components\Bin\Framework folder will be replaced with the modified assembly.

    Note

    • The default path for XAF solution references is %PROGRAMFILES%\DevExpress 24.1\Components\Bin\Framework. If you use an alternate path, copy the created DevExpress.Persistent.BaseImpl.Xpo.v24.1.dll or DevExpress.Persistent.BaseImpl.EFCore.v24.1.dll assembly to the appropriate location.
    • Some XPO-only modules (Audit Trail and Clone Object) have references to the DevExpress.Persistent.BaseImpl.Xpo.v24.1.dll library. If you are using these modules in your application, they must also be rebuilt. Refer to the following topic for details: How to rebuild assemblies from the source code.

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"
            );
        }
    }
}
See Also