The requested page is not available for the requested platform. You are viewing the content for Default platform.

IObjectSpace.GetObject(Object) Method

Retrieves an object that corresponds to a specific object from another Object Space or to a specific record from a data view created by the IObjectSpace.CreateDataView method.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

object GetObject(
    object obj
)
Function GetObject(
    obj As Object
) As Object

Parameters

Name Type Description
obj Object

An object from another Object Space or the data view record corresponding to the required persistent object.

Returns

Type Description
Object

An object retrieved from the database via the current Object Space.

Remarks

The example below demonstrates how to use the GetObject method.

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;

// ...
public class ShowDetailViewController : ObjectViewController<ListView, Person> {
    public ShowDetailViewController() {
        PopupWindowShowAction showDetailViewAction = new PopupWindowShowAction(
            this, "ShowDetailView", PredefinedCategory.Edit);
        showDetailViewAction.SelectionDependencyType = SelectionDependencyType.RequireSingleObject;
        showDetailViewAction.CustomizePopupWindowParams += ShowDetailViewAction_CustomizePopupWindowParams;
    }
    private void ShowDetailViewAction_CustomizePopupWindowParams(
        object sender, CustomizePopupWindowParamsEventArgs e) {
        IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Person));
        Object currentObject = objectSpace.GetObject(View.CurrentObject);
        if(currentObject != null) {
            e.View = Application.CreateDetailView(objectSpace, currentObject, true);
        }
        else {
            objectSpace.Dispose();
        }
    }
}
See Also