Skip to main content
.NET Framework 4.5.2+

IObjectSpaceLink Interface

Implemented by business classes that provide a reference to an associated Object Space.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v22.1.dll

Declaration

Remarks

You can use the XAF Business Object | EF 6 Business Object from Template Gallery to add a class that supports both IXafEntityObject and IObjectSpaceLink. To support IObjectSpaceLink in an existing class, use the following code.

[DefaultClassOptions]
public class Contact : IObjectSpaceLink {
    //...
    IObjectSpace objectSpace;
    IObjectSpace IObjectSpaceLink.ObjectSpace {
        get { return objectSpace; }
        set { objectSpace = value; }
    }
}

An Object Space reference is automatically assigned to the IObjectSpaceLink.ObjectSpace property when a business object supporting IObjectSpaceLink is created using IObjectSpace methods. All data manipulations are preformed using these methods in internal XAF code, and it is recommended to use IObjectSpace in your custom code as well. You can implement this interface and access other business objects directly in the current object code. For example, you can write certain business logic in the IXafEntityObject.OnCreated, IXafEntityObject.OnLoaded and IXafEntityObject.OnSaving methods, as demonstrated in the IXafEntityObject interface description.

Note

  • The Object Space reference is set to null (Nothing in VB) when an object is being deleted.
  • You cannot share non-persistent objects that implement IObjectSpaceLink between different Object Spaces. For example, an exception is thrown when you open a Detail View for an object selected in a List View. To address this exception, subscribe to the NonPersistentObjectSpace.ObjectGetting event, create a new object instance, and copy property values from the source object.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IObjectSpaceLink interface.

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.

See Also