Skip to main content
All docs
V24.1
.NET Framework 4.5.2+

CompositeObjectSpace.PopulateAdditionalObjectSpaces(XafApplication) Method

Creates Object Spaces for registered Object Space Providers and adds them to the AdditionalObjectSpaces collection. Object Spaces in this collection are automatically disposed of with the owner Object Space.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public void PopulateAdditionalObjectSpaces(
    XafApplication application
)

Parameters

Name Type Description
application XafApplication

An XAF application instance where Object Space Providers are registered.

Remarks

Follow the steps below to use this method:

  1. Handle the OnObjectSpaceCreated event in the Application Builder code in the application’s Startup.cs file.
  2. In the event handler, call the PopulateAdditionalObjectSpaces(IObjectSpaceProviderService, IObjectSpaceCustomizerService) method to populate the AdditionalObjectSpaces collection with all necessary Object Spaces.

File: MySolution.Blazor.Server/Startup.cs, MySolution.Win/Startup.cs, MySolution.WebApi/Startup.cs

using DevExpress.ExpressApp;
//...
builder.ObjectSpaceProviders.Events.OnObjectSpaceCreated = context => {
    CompositeObjectSpace compositeObjectSpace = context.ObjectSpace as CompositeObjectSpace;
    if (compositeObjectSpace != null) {
        if (!(compositeObjectSpace.Owner is CompositeObjectSpace)) {
            var objectSpaceProviderService = context.ServiceProvider.GetRequiredService<IObjectSpaceProviderService>();
            var objectSpaceCustomizerService = context.ServiceProvider.GetRequiredService<IObjectSpaceCustomizerService>();
            compositeObjectSpace.PopulateAdditionalObjectSpaces(objectSpaceProviderService, objectSpaceCustomizerService);
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PopulateAdditionalObjectSpaces(XafApplication) method.

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.

See Also