expressappframework-devexpress-dot-expressapp-dot-objectspaceproviderevents.md
Occurs after an Object Space has been created by an IObjectSpaceFactory.
Namespace : DevExpress.ExpressApp
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
public Action<ObjectSpaceCreatedContext> OnObjectSpaceCreated { get; set; }
Public Property OnObjectSpaceCreated As Action(Of ObjectSpaceCreatedContext)
| Type | Description |
|---|---|
| Action<DevExpress.ExpressApp.ObjectSpaceCreatedContext> |
A delegate method that takes a context object as an argument.
|
You can handle this event in the following ways:
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;
// ...
};
// ...
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;
//...
};
});
See Also
XafApplication.ObjectSpaceCreated
How to: Perform CRUD Operations with Non-Persistent Objects
ObjectSpaceProviderEvents Class