Specifies a custom list of Object Space Providers to be used by the application.
An IList<IObjectSpaceProvider> list of custom Object Space Providers to be used by the application.
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.
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:
- To get XafApplication.ObjectSpaceProvider and XafApplication.ConnectionString property values.
- To pass this Provider as the CustomCheckCompatibilityEventArgs ObjectSpaceProvider argument.
- To update an application.
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.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ObjectSpaceProviders property.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.