BaseObjectSpace.FindObjectSpaceByObject(Object) Method
Returns the Object Space used to load and save a specified persistent object. This method is for internal use.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.1.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Parameters
Name | Type | Description |
---|---|---|
obj | Object | The object whose Object Space this method returns. |
Returns
Type | Description |
---|---|
IObjectSpace | An Object Space used to load and save the specified persistent object. null (Nothing in VB.NET) if the specified object does not belong to any Object Space. |
Remarks
This method is for internal use. It can access certain Object Spaces XAF uses internally (for example, the Object Space used by the Security System). Do not use such Object Spaces in your applications because this may cause unexpected behavior. Instead of this, implement the approaches below.
To access an object’s Object Space in the class code, use one of the following options:
- Implement the IObjectSpaceLink interface in non-persistent classes.
- Use the automatically implemented IObjectSpaceLink interface in EF Core classes.
- Use the object’s Session in XPO persistent classes.
In other cases, create a new Object Space and use the GetObject(Object) method to retrieve an object in the current Object Space.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FindObjectSpaceByObject(Object) 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.