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.v22.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
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:
- Handle the XafApplication.ObjectSpaceCreated event in a module or Controller.
- In the event handler, call the
PopulateAdditionalObjectSpaces(XafApplication)
method to populate the AdditionalObjectSpaces collection with all necessary Object Spaces.
The following example demonstrates how to do this in a platform-agnostic module (MySolution.Module/Module.cs(vb)):
using DevExpress.ExpressApp;
//...
public class MySolutionModule : ModuleBase {
//...
public override void Setup(XafApplication application) {
base.Setup(application);
application.ObjectSpaceCreated += Application_ObjectSpaceCreated;
}
private void Application_ObjectSpaceCreated(object sender, ObjectSpaceCreatedEventArgs e) {
CompositeObjectSpace compositeObjectSpace = e.ObjectSpace as CompositeObjectSpace;
if (compositeObjectSpace != null) {
if (!(compositeObjectSpace.Owner is CompositeObjectSpace)) {
compositeObjectSpace.PopulateAdditionalObjectSpaces((XafApplication)sender);
}
}
}
}
Related GitHub Examples
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.