Hello DevExpress Team,
I have a question regarding list views in dataview mode and actions.
Background:
To make sure that our ViewControllers work correctly both in DataView mode and none-DataView mode we created our own action class (derived from SimpleAction).
In its overwritten RaiseExecute method we check the passed (SimpleActionExecuteEventArgs)eventArgs object
whether its CurrentObject/SelectedObjects properties contain objects of type XafDataViewRecord.
If this is the case we want to replace them with the 'real' objects (queried by ObjectSpace.GetObjects).
C#protected override void RaiseExecute(ActionBaseEventArgs eventArgs)
{
var simpleActionEventArgs = GetRealEventArgs(eventArgs, this);
...
base.RaiseExecute(simpleActionEventArgs ?? eventArgs);
}
Currently we replace the eventargs with a new instance that contains the real objects:
C#public static ActionBaseEventArgs GetRealEventArgs(ActionBaseEventArgs eventArgs, ActionBase action)
{
var simpleActionEventArgs = (SimpleActionExecuteEventArgs)eventArgs;
...
var typeInfo = XafTypesInfo.CastTypeToTypeInfo(simpleActionEventArgs.CurrentObject.GetType());
if (!typeInfo.Implements<XafDataViewRecord>() )
return null;
var realObjects = GetRealObjectsInternal(...); // Get corresponding objects via ObjectSpace.GetObjects
var realCurrentObject = GetCurrentObjectInternal(...);
return new SimpleActionExecuteEventArgs(action, new OurSelectionContext(realCurrentObject, realObjects));
}
-> Drawback: Querying of the real objects always takes place when an action is executed, no matter if anybody actually needs them.
So my question is:
Would it be possible to make the SimpleActionExecuteEventArgs Properties CurrentObject and SelectedObjects virtual?
Then we could derive our own class from SimpleActionExecuteEventArgs and query the real objects in these getter functions if needed.
So the queries only would take place if someone accesses SelectedObjects (or CurrentObject).
Or do you have any other suggestions for this problem?
Thanks for your help,
Witold