ObjectSpaceProviderEvents.OnObjectSpaceCreated Property
Occurs after an Object Space has been created by an IObjectSpaceFactory.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Property Value
Type | Description |
---|---|
Action<DevExpress.ExpressApp.ObjectSpaceCreatedContext> | A delegate method that takes a context object as an argument. |
Remarks
You can handle this event in the following ways:
Use the Application Builder
In the application’s Startup.cs file, add the following lines to the application builder code:
File: * MySolution.Blazor.Server/Startup.cs, MySolution.Win/Startup.cs, MySolution.WebApi/Startup.cs
using DevExpress.ExpressApp;
// ...
builder.ObjectSpaceProviders.Events.OnObjectSpaceCreated += context => {
// Use the `context.ObjectSpace` property to access the created Object Space.
IObjectSpace os = context.ObjectSpace;
// ...
};
// ...
Use the Options Pattern
In the application’s Startup.cs file, call the services.PostConfigure method to configure the ObjectSpaceProviderOptions
as shown below:
File: MySolution.Blazor.Server/Startup.cs, MySolution.Win/Startup.cs, MySolution.WebApi/Startup.cs
using DevExpress.ExpressApp;
// ...
services.PostConfigure<ObjectSpaceProviderOptions>(options => {
options.Events.OnObjectSpaceCreated += context => {
// Use the `context.ObjectSpace` property to access the created Object Space.
IObjectSpace os = context.ObjectSpace;
//...
};
});