XafApplication.CreateCustomObjectSpaceProvider Event
Occurs when setting up the application.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.1.dll
NuGet Package: DevExpress.ExpressApp
#Declaration
public event EventHandler<CreateCustomObjectSpaceProviderEventArgs> CreateCustomObjectSpaceProvider
#Event Data
The CreateCustomObjectSpaceProvider event's data class is CreateCustomObjectSpaceProviderEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Connection | Specifies the connection type to be used by an Object Space Provider. |
Connection |
Specifies the connection string to be used by the Object Space Provider’s data layer. |
Is |
Specifies whether or not the Object Space Provider is disposed of when the application is disposed of. |
Object |
Specifies a custom Object Space Provider to be used by the application. |
Object |
Specifies a custom list of Object Space Providers to be used by the application. |
#Remarks
Handle this event if you require the application to use a custom Object Space Provider. Use the handler’s CreateCustomObjectSpaceProviderEventArgs.Connection and CreateCustomObjectSpaceProviderEventArgs.ConnectionString parameters to get the connection type and connection string that are set for the application. The created Object Space Provider should be set for the handler’s CreateCustomObjectSpaceProviderEventArgs.ObjectSpaceProvider parameter, so that the default Object Space Provider is not created.
You can also pass several Object Space Providers to the CreateCustomObjectSpaceProviderEventArgs.ObjectSpaceProviders parameter. In this instance, 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 Object Space Providers list is assigned to the XafApplication.ObjectSpaceProviders property. Created Object Space Providers are not disposed automatically, and each provider keeps an SQL connection active. You should manually dispose of them when they are not required.
Note
When multiple Object Space Providers are registered in the Xaf
#Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateCustomObjectSpaceProvider event.
Note
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.