Provides access to Object Spaces in ASP.NET Core applications.
NuGet Package: DevExpress.ExpressApp
IObjectSpaceFactory service allows you to use the DI-accessible API to create Object Spaces. Note that this service requires that IObjectSpaceProviderFactory is registered in your application. In applications created in v22.1+, the Solution Wizard registers this service automatically. In applications created in v21.2 and earlier, implement this service manually as shown in the IObjectSpaceProviderFactory description.
IObjectSpaceFactory service is the analog of the CreateObjectSpace(Type) method. The main difference between these techniques is that the service does not require an application instance. This improves your application performance but leads to the following restrictions:
- Customizations made in the application context (for example, in the XafApplication.ObjectSpaceCreated event handler) are ignored.
- Specific Modules that rely on an application instance (for example, Audit Trail Module (XPO)) are not currently compatible with this service.
You can use the following Object Space Factories in different scenarios:
- Creates Object Spaces for secured operations. In applications with the Security System, it ensures if the current user is logged on. Otherwise, it throws an authorization exception (refer to the following topic for information on how to avoid this exception: Access Object Space, Security System, Caption Helper, and XAF Modules in the ASP.NET Core Environment). Protected data is available depending on current user permissions. In applications without the Security System, this service operates the same way as
- Creates Object Spaces for non-secured operations. These Object Spaces have full access to all objects and operations, despite user permission settings.
- Creates secured Object Spaces with additional permissions required for database update (for example, for new table creation). For more information, refer to the following method description: IObjectSpaceProvider.CreateUpdatingObjectSpace.
Refer to the following help topics to find examples on how to use this service in different scenarios:
- Access an Object Space, Security System, Caption Helper, and XAF Modules in the ASP.NET Core Environment
- Access an Object Space, Security System, and Caption Helper in Custom Endpoint Methods