Retrieves an object that corresponds to an IObjectRecord wrapper or object from another Object Space.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v19.2.dll
Name | Type | Description |
---|---|---|
obj | Object | A business object wrapper or object from another Object Space that corresponds to the required persistent object. |
Type | Description |
---|---|
Object | An object retrieved from the database via the current Object Space. |
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();
}
}
}