The complete description is available in the How to: Display a Non-Persistent Object's Detail View from the Navigation help topic.
Question Comments
Added By: DKx at: 7/1/2015 7:27:56 AM
This code fails with session-based non-persistent classes when Refresh action is called:
"The error occurred:
Type: SessionMixingException
Message: The 'Example.Module.MyNonPersistentObject' object belongs to a different session."
void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
{
if (e.Shortcut.ViewId == "MyNonPersistentObject_DetailView")
{
IObjectSpace objectSpace = Application.CreateObjectSpace();
e.View = Application.CreateDetailView(objectSpace, objectSpace.CreateObject<MyNonPersistentObject>(), true);
e.Handled = true;
}
}
How to solve it?
Added By: Dennis (DevExpress Support) at: 7/1/2015 11:26:44 AM @DKx: It is wrong to inherit non-persistent classes from the base XPO classes like BaseObject, XPObject, etc. Use session-less POCOs instead (like demonstrated in this example).