Skip to main content
.NET Framework 4.5.2+

XafApplication Class

Manages an XAF application.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public abstract class XafApplication :
    Component,
    INotifyPropertyChanged,
    ISupportInitialize,
    IApplicationModelManagerProvider,
    IInternalCollectionSourceCreating

Remarks

The XafApplication class contains methods to create Controllers, Views, Object Space (see BaseObjectSpace), and other XAF elements. Its properties specify application name and title, configuration string, provide access to the Application Model, modules and the strategy that manages View visibility. You can customize many built-in mechanisms to manage your application. For this purpose, use XafApplication‘s events.

XAF creates and initializes a XafApplication descendant as follows:

Platform Created and Initialized File
ASP.NET Core Blazor When IXafApplicationProvider.GetApplication() is called for the first time (usually when XAF initializes the page). Startup.cs
Windows Forms In the Main method. Program.cs
ASP.NET Web Forms When a session starts. Global.asax.cs
Application Server In the ApplicationServerService constructor. ApplicationServerService.cs
Backend Web API Service / REST API Only during initialization. Startup.cs

Note

XafApplication is not available in Web API Service endpoints. XAF creates it on service initialization only for compatibility check and localization services setup.

To configure your application, use Application Builder.

Usage Considerations

XafApplication is essential for an application’s initial setup (for example, to set up modules and gather TypesInfo). However, after this initial setup, some services can function independently of XafApplication. We recommend that you use the APIs provided by these services instead of the XafApplication API for the same tasks because events and methods within XafApplication may not trigger if the corresponding operation occurs outside its context.

For example, if you subscribe to the XafApplication.ObjectSpaceCreated event, it is not guaranteed to fire because it is possible to create IObjectSpace outside of XafApplication. To handle occurrences when an IObjectSpace is created use the ObjectSpaceProviderEvents.OnObjectSpaceCreated method.

As another important example, you need to keep in mind that the XafApplication.LoggedOn does not fire every time that a user is logged in by the Security System. For instance, the event does not fire in the following cases:

For more information and examples, refer to the following ticket: Core - ValueManager API availability and deprecated static helpers in XAF .NET 6+ apps (Blazor, Web API Service, WinForms).

Extension Methods

See Also