Skip to main content
All docs
V25.1
  • .NET 8.0+
    • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

    DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    ObjectSpaceProviderEvents.OnObjectSpaceCreated Property

    Occurs after an Object Space has been created by an IObjectSpaceFactory.

    Namespace: DevExpress.ExpressApp

    Assembly: DevExpress.ExpressApp.v25.1.dll

    NuGet Package: DevExpress.ExpressApp

    #Declaration

    public Action<ObjectSpaceCreatedContext> OnObjectSpaceCreated { get; set; }

    #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;
            //...
        };
    });
    
    See Also