IObjectSpaceFactory Interface
Provides access to Object Spaces in ASP.NET Core applications.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.1.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Remarks
The 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 and later, 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.
The IObjectSpaceFactory
service is the counterpart 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 restriction:
- Customizations made in the application context (for example, in the XafApplication.ObjectSpaceCreated event handler) are ignored.
You can use the following Object Space Factories in different scenarios:
IObjectSpaceFactory
- Creates Object Spaces for secured operations. In applications with the Security System, it checks whether the current user is logged on. If the user is not logged on, 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
INonSecuredObjectSpaceFactory
. - INonSecuredObjectSpaceFactory
- Creates Object Spaces for non-secured operations. These Object Spaces have full access to all objects and operations, regardless of user permission settings.
IUpdatingObjectSpaceFactory
- 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