expressappframework-devexpress-dot-expressapp-dot-baseobjectspace-dot-findobjectspacebyobject-x28-system-dot-object-x29.md
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.v25.2.dll
NuGet Package : DevExpress.ExpressApp
public static IObjectSpace FindObjectSpaceByObject(
object obj
)
Public Shared Function FindObjectSpaceByObject(
obj As Object
) As IObjectSpace
| Name | Type | Description |
|---|---|---|
| obj | Object |
The object whose Object Space this method returns.
|
| Type | Description |
|---|---|
| IObjectSpace |
An Object Space used to load and save the specified persistent object. null if the specified object does not belong to any Object Space.
|
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:
In other cases, create a new Object Space and use the GetObject(Object) method to retrieve an object in the current Object Space.
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.
private static bool IsNewObject(object obj) {
var sourceObjectSpace = BaseObjectSpace.FindObjectSpaceByObject(obj);
return sourceObjectSpace == null ? false : sourceObjectSpace.IsNewObject(obj);
Private Shared Function IsNewObject(ByVal obj As Object) As Boolean
Dim sourceObjectSpace = BaseObjectSpace.FindObjectSpaceByObject(obj)
Return If(sourceObjectSpace Is Nothing, False, sourceObjectSpace.IsNewObject(obj))
See Also