I recently being asked a lot about a way of making Xaf front end (that is your Solution.Win,Solution.Web) able to host controllers. To many of them i answered that is not possible cause of the Xaf architecture but haven’t thought of it, It was a rushed answer. Anyway i do not have to make a lot of thoughts on it since my friend Panagiotis Kefalidis share that trick with us.
First lets give an example of why you want to run controller in your front end. Many licensing systems need to have access to your executable and through it to your main form in order to protect it. For Xaf the only way to get access to your form is through a controller.
So the trick is to fool Xaf front end to make it behave like a module. Modules are capable to run controllers. And how you can do that?
It is really easy all you have to do is to add a DevExpress.ExpressApp.ModuleBase derived class to your front end like
then goto your WinApplication.Designer.cs
instantiate your module at your InitializeComponent method
and add it to application’s modules list
And you are done!!!!
See you at next tip