XafApplication.ObjectSpaceCreated Event
Occurs after an Object Space has been created via the XafApplication.CreateObjectSpace method.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Event Data
The ObjectSpaceCreated event's data class is ObjectSpaceCreatedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
ObjectSpace | Gets the Object Space. |
Remarks
Note
This is a legacy event. In new applications, we recommend that you use the ObjectSpaceProviderEvents.OnObjectSpaceCreated event for most use case scenarios. Refer to the Usage Considerations section for details.
If you need to access the Object Space created for a particular View, handle the ObjectSpaceCreated event and use its ObjectSpaceCreatedEventArgs.ObjectSpace parameter.
Note that nested Object Spaces are created by the XPObjectSpace.CreateNestedObjectSpace method. So, the ObjectSpaceCreated
event is not raised when a nested Object Space is created.
Usage Considerations
The XafApplication.ObjectSpaceCreated
event fires only for Object Spaces that are created by an XAF Application and within the XAF Application context (for example, in an XAF Controller).
Keep in mind that XafApplication
does not host the Object Space creation logic and instead uses the IObjectSpaceFactory service to create Object Spaces. Other services can also directly use IObjectSpaceFactory
to create Object Spaces without communicating with XafApplication
. In such cases, the ObjectSpaceProviderEvents.OnObjectSpaceCreated event fires when an Object Space is created, but the XafApplication.ObjectSpaceCreated
event does not.
Adhere to the following recommendations to choose the correct event to use:
- If you need to implement global logic that must be triggered by the creation of any
IObjectSpace
within the application, use ObjectSpaceProviderEvents.OnObjectSpaceCreated. - If logic that you want to implement operates on XAF Application elements (XAF Controllers, View UI elements, and so on), you may prefer to use
XafApplication.ObjectSpaceCreated
for convenience.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ObjectSpaceCreated event.
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.