Skip to main content
.NET 8.0+

NonPersistentObjectSpace Class

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public class NonPersistentObjectSpace :
    CompositeObjectSpace

Remarks

To enable the use of NonPersistentObjectSpace, the following code should be added to the overridden CreateDefaultObjectSpaceProvider method located in the WinApplication.cs (WinApplication.vb) and/or WebApplication.cs (WebApplication.vb) file (in addition to the existing XPObjectSpaceProvider or EFObjectSpaceProvider).

protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) {
    // ...
    args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
}

Currently, this code is added automatically by the Solution Wizard, but it may be missing if you have created your project using an older version of XAF.

Note

XAF uses the first registered Object Space Provider for the following purposes:

Ensure that NonPersistentObjectSpaceProvider is not the first registered Provider in your application.

Note that in applications with the Application Builder, you need to use the Application Builder’s ObjectSpaceProviders property to register Object Space Providers instead of the XafApplication.CreateDefaultObjectSpaceProvider method or XafApplication.CreateCustomObjectSpaceProvider event to register Object Space Providers. Refer to the following help topic for more information on how to do this: Integrate Application Builders into Existing Applications.

We strongly recommend this because the use of the XafApplication.CreateDefaultObjectSpaceProvider method and XafApplication.CreateCustomObjectSpaceProvider event conflicts with IObjectSpaceFactory and IObjectSpaceProviderFactory service usage.

This technique also improves performance of your application because the application instance is not created in this case.

To supply non-persistent objects for NonPersistentObjectSpace, use the NonPersistentObjectSpace.ObjectsGetting event that occurs when NonPersistentObjectSpace creates an object collection. You can find examples in the following topics:

To supply an object returned by the NonPersistentObjectSpace.GetObject method, use the NonPersistentObjectSpace.ObjectGetting event.

The New, Delete and Save Actions are available for non-persistent objects. To access all created, deleted and modified objects within NonPersistentObjectSpace, use the NonPersistentObjectSpace.ModifiedObjects property.

The IObjectSpaceLink.ObjectSpace property of non-persistent objects that support IObjectSpaceLink is initialized in these cases:

If an object from another Object Space passed to the GetObject method implements IObjectSpaceLink, and its ObjectSpace property is null, the current NonPersistentObjectSpace assigns a link to itself in this property. Similar behavior is implemented for objects returned by the GetObjects and CreateCollection methods using the NonPersistentObjectSpace.ObjectsGetting event.

Implements

Inheritance

See Also