To help consolidate UI code, sometimes it is possible to create an interface that can be implemented against multiple business classes and have a ViewController work against that interface. At the moment to set the controller active or inactive based on an interface some code has to be written in the controller activated event. One line of code, but perhaps it may be helpful to have it available from the UI.
Proposed Solution:
List interfaces in the TargetObjectType property to allow for controller activation based on an interface.
Designers.ViewController - allow controllers to have an interface as a target object type
Answers approved by DevExpress Support
Hello Mark,
Currently, you can initialize the "TargetObjectType" property in code, for example:
this.TargetObjectType = typeof(IReportData);
The standard "Reports" module works in this way.
However, the Controller designer doesn't show interfaces in the dropdown list for the "TargetObjectType". It's easy to collect all the business classes, because all of them are marked with [Persistent] or [NonPersistent] attributes and collected by XPO, while interfaces are not processed at all.
So, you can associate a controller with an interface in code. We will look into this inconsistency and see how to make it better.
See Also:
Core - Make it possible to activate the same ViewController or Action for multiple Views or target object types
Thanks, Dan.