Using the XAF Scheduler Module with Domain Components

It had been a while since I last looked at XAF from DevExpress, and since then the new Domain Components technology has been released in version 11.2. I decided to take a look at this new technology recently and see how exactly to make use of it.

The technology itself looks very promising, but makes using some of XAF’s modules require a little extra effort in some cases. This post will go over how to use the combination of Domain Components with the SchedulerWindowsFormsModule, which takes several steps beyond those required when using normal Domain Objects.

Start off by creating a new XAF Cross-Platform Application solution.

As with any XAF based project, build the solution first so that type information is available to the XAF model editor.

Expand the WinForms (Win) application project in the Solution Explorer and double-click WinApplication.cs. Side-note: on this designer you can select the Sql Connection and edit the connection string if necessary.

Locate the SchedulerWindowsFormsModule in the XAF Modules category of the Toolbox and drag to the Modules window in WinApplication.cs

Next, in the Solution Explorer, expand the common module project and double-click Module.cs. Under Exported Types, expand Referenced assemblies and then DevExpress.Persistent.Base.vXX.Y. Right-click IPersistentRecurrentEvent (the DC we’ll be using) and click Use Type In Application

Build the solution. This is necessary so that the newly included types are available in the model editors.

So far, this is very similar to using the Domain Objects. The exception being that we’ve included the Domain Component interfaces rather than the Domain Object classes (Event, Resource).

Now, right-click the Module.cs designer and click View Code. Add the following code:

        public override void Setup(XafApplication application)

            //register scheduling Domain Components
            XafTypesInfo.Instance.RegisterEntity("Event", typeof(DomainComponents.Common.IPersistentRecurrentEvent));
            XafTypesInfo.Instance.RegisterEntity("Resource", typeof(DomainComponents.Common.IPersistentResource));

This code is necessary with Domain Components to register the interfaces with XAF.

Next we’ll need to make some modifications to the model so that the scheduler user interface elements are displayed. These steps are taken care of automatically when using the Event Domain Object. Right-click the common module project in the Solution Explorer and click Open Model Editor.

Expand NavigationItems. Then, right-click Items, go to Add, and then NavigationItem.

Select the new navigation item and, on the right, under View, select IPersistentRecurrentEvent_ListView. If you do not see IPeristentRecurrentEvent_ListView, close the model editor, rebuild, and try again.

Back in the model editor tree, expand Views, followed by DomainComponents.Common, IPersistentRecurrentEvent_DetailView, Layout, Main, and finally SimpleEditors. Select IPersistentEvent and, on the right, change Caption to Event.

Again in the model editor tree, above Layout, expand Items. Find and delete the AppointmentId and Pattern items (normally hidden by the built in Event Domain Object).

And now run the WinForms project.

You can download the sample project here.


One thought on “Using the XAF Scheduler Module with Domain Components

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s