Quantcast
Channel: eXpandFramework RSS
Viewing all articles
Browse latest Browse all 861

BLOG by Dennis Garavsky: A trick for the XAF application server

$
0
0

As you probably know, the Application Server creates its own GUI-less XafApplication descendant - ServerApplication. When working with Application Server, you should be aware of a very important requirement desribed at http://documentation.devexpress.com/#Xaf/CustomDocument3438:

 

The ServerApplication.Modules collection. It should contain modules that are directly referenced by your client application. To see which client application modules are required, refer to the InitializeComponent method code in your WinApplication/WebApplication descendant. There is no need to add modules that are indirectly added to your client application (i.e., modules that are added to your custom modules).

 

In this blog post, I would like you to show you how to comply with this requirement without having to add extensive references to all the extra modules used in your client apps, and having to write a great number of lines like: serverApplication.Modules.Add(new DevExpress.ExpressApp.XXX.XXXModule());

My goal is to save you time in adding these references (the "Add Reference | .NET"  dialog has always been and still is one of the weakest places in Visual Studio) and writing unfamiliar code in Visual Studio. Technically, I want to achieve this by cutting this initialization code to just a few lines:

 ServerApplication serverApplication = new ServerApplication();
// Change the ServerApplication.ApplicationName property value. It should be the same as your client application name.
serverApplication.ApplicationName = "idamss";
// Add your client application's modules to the ServerApplication.Modules collection here.
serverApplication.Modules.Add(new MySolution.Module.MyCommonModule());
serverApplication.Modules.Add(new MySolution.Module.Win.MyWindowsFormsModule());
serverApplication.Modules.Add(new MySolution.Module.Web.MyAspNetModule());

I refer here to my own modules, with which I am very familiar. It is also very easy to reference my modules in the "Add Reference | Projects" dialog by selecting them all at once. I  need nothing else here, because all the other modules can be added indirectly to my modules. I'll demonstrate this with some screenshots:

1

Here you can see the Module Designer opened for MySolution.Module.MyCommonModule.

2

Here you can see the Module Designer opened for MySolution.Module.Win.MyWindowsFormsModule

The main idea is to add extra modules into these module projects by dragging them from the Toolbox when you are in the Module Designer, which is fast and easy. This way, all the references and plumbing code will be added automatically.

Of course, it can be achieved more easily, and we have the corresponding request in our TODO list: http://www.devexpress.com/Support/Center/Issues/ViewIssue.aspx?issueid=S38219

Feel free to share your ideas and suggestions on how to make this more usable for developers.

 

Permalink | Leave a comment  »


Viewing all articles
Browse latest Browse all 861

Trending Articles