Skip to main content
.NET 8.0+

CreateCustomObjectSpaceProviderEventArgs.ObjectSpaceProviders Property

Specifies a custom list of Object Space Providers to be used by the application.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public List<IObjectSpaceProvider> ObjectSpaceProviders { get; }

Property Value

Type Description
List<IObjectSpaceProvider>

An IList<IObjectSpaceProvider> list of custom Object Space Providers to be used by the application.

Remarks

When several Object Space Providers are passed to the ObjectSpaceProviders property, the Object Space Provider appropriate for each particular business object type is determined automatically. However, if you want to create an Object Space manually, use an overload of the XafApplication.CreateObjectSpace method that takes the objectType parameter.

The passed list is assigned to the XafApplication.ObjectSpaceProviders property.

Note

When multiple Object Space Providers are registered in the XafApplication.ObjectSpaceProviders property, the ModuleUpdater.UpdateDatabaseAfterUpdateSchema method is executed multiple times, once for each registered Provider. In this method, before accessing an object of a particular type, check if the current Object Space supports this type using the IObjectSpace.CanInstantiate method.

XAF uses the first registered Object Space Provider for the following purposes:

Ensure that NonPersistentObjectSpaceProvider is not the first registered Provider in your application.

Note that in applications with the Application Builder, you need to use the Application Builder’s ObjectSpaceProviders property to register Object Space Providers instead of the XafApplication.CreateDefaultObjectSpaceProvider method or XafApplication.CreateCustomObjectSpaceProvider event to register Object Space Providers. Refer to the following help topic for more information on how to do this: Integrate Application Builders into Existing Applications.

We strongly recommend this because the use of the XafApplication.CreateDefaultObjectSpaceProvider method and XafApplication.CreateCustomObjectSpaceProvider event conflicts with IObjectSpaceFactory and IObjectSpaceProviderFactory service usage.

This technique also improves performance of your application because the application instance is not created in this case.

See Also