Back to Devexpress

XafApplication Class

expressappframework-devexpress-dot-expressapp-204de80b.md

latest7.1 KB
Original Source

XafApplication Class

Manages an XAF application.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public abstract class XafApplication :
    Component,
    INotifyPropertyChanged,
    ISupportInitialize,
    IApplicationModelManagerProvider,
    IInternalCollectionSourceCreating,
    IAsyncDisposable
vb
Public MustInherit Class XafApplication
    Inherits Component
    Implements INotifyPropertyChanged,
               ISupportInitialize,
               IApplicationModelManagerProvider,
               IInternalCollectionSourceCreating,
               IAsyncDisposable

The following members return XafApplication objects:

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:

PlatformCreated and InitializedFile
ASP.NET Core BlazorWhen IXafApplicationProvider.GetApplication() is called for the first time (usually when XAF initializes the page).Startup.cs
Windows FormsIn the Main method.Program.cs
Application ServerIn the ApplicationServerService constructor.ApplicationServerService.cs
Backend Web API Service / REST APIOnly 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.

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).

Inheritance

Object MarshalByRefObject Component XafApplication AspNetCoreApplication

WinApplication

BlazorApplication

Extension Methods

GetSecurityStrategy()

See Also

XafApplication Members

DevExpress.ExpressApp Namespace