expressappframework-devexpress-dot-expressapp-dot-compositeobjectspace-dot-populateadditionalobjectspaces-x28-devexpress-dot-expressapp-dot-xafapplication-x29.md
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.v25.2.dll
NuGet Package : DevExpress.ExpressApp
public void PopulateAdditionalObjectSpaces(
XafApplication application
)
Public Sub PopulateAdditionalObjectSpaces(
application As XafApplication
)
| Name | Type | Description |
|---|---|---|
| application | XafApplication |
An XAF application instance where Object Space Providers are registered.
|
Follow the steps below to use this method:
Startup.cs file.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 snippets (auto-collected from DevExpress Examples) contain references 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.
if (!(compositeObjectSpace.Owner is CompositeObjectSpace)) {
compositeObjectSpace.PopulateAdditionalObjectSpaces((XafApplication)sender);
}
if(!(npos.Owner is CompositeObjectSpace)) {
npos.PopulateAdditionalObjectSpaces((XafApplication)sender);
}
if(!(npos.Owner is CompositeObjectSpace)) {
npos.PopulateAdditionalObjectSpaces((XafApplication)sender);
}
if(!(cos.Owner is CompositeObjectSpace)) {
cos.PopulateAdditionalObjectSpaces((XafApplication)sender);
cos.AutoCommitAdditionalObjectSpaces = true;
if(nonPersistentObjectSpace != null) {
nonPersistentObjectSpace.PopulateAdditionalObjectSpaces(application);
}
Private Sub Application_ObjectSpaceCreated(ByVal sender As Object, ByVal e As ObjectSpaceCreatedEventArgs)
TryCast(e.ObjectSpace, CompositeObjectSpace)?.PopulateAdditionalObjectSpaces(CType(sender, XafApplication))
End Sub
See Also