Click here to Skip to main content
13,143,618 members (31,383 online)
Click here to Skip to main content
Add your own
alternative version

Stats

6.5K views
1 bookmarked
Posted 29 Nov 2015

15.2 What's New for XAF

, 29 Nov 2015
Rate this:
Please Sign up or sign in to vote.
What brings the 15.2 release for XAF (win) developers

Editorial Note

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.

Introduction

As an active developer for over 15 years, I have seen a few frameworks pass by, each having their advantages and disadvantages… A few years ago, I was given the opportunity to introduce .NET in a company that decided it was time to migrate from Delphi to .NET.

Although I realized that it was not a trivial task, I knew where I was going. XAF presented to me a number of features and out of the box functionality which gave me a head start. Continuous improvement over the years has brought us today to 15.2.

Let's have a look at what 15.2 has up its sleeve for us.

Areas of Focus

Due to the nature of the projects I'm involved in at the moment, the primary focus will be Winforms and EF, however some improvements for web applications are worth mentioning here.

What's New

ASP.NET Maps Module

The new Maps modules allows us to visualise any data on map.

So if I would like to show the revenue for the worldwide stores or point out on a map where it's located? The maps module will be able to assist you on this.

Just a little code needs to be written to customize the underlaying dxMap;

using DevExpress.Persistent.Base;

namespace DevExpress.ExpressApp.Maps.Web.Controllers {
   public class MapCenterController : ObjectViewController<ListView, Store> {
       protected override void OnViewControlsCreated() {
           base.OnViewControlsCreated();
           ((WebMapsListEditor)View.Editor).MapViewer.ClientSideEvents.Customize = GetCustomizeScript();
       }

       private string GetCustomizeScript() {
           return @"function(sender, map) {
                  map.option('center', 'Brooklyn Bridge,New York,NY');
                  map.option('autoAdjust', false);
                  }";
       }
   }
}

Validation Module (Win + Web)

The built in validation has always been a strong point of XAF, There are not many scenarios that are not covered by the built-in. Up to 15.1, the validation was triggerd when saving changes or manually when the validate button was pressed. In 15.2, for a subset of validation rules, validation occurs immediately after input focus changes. Important here is that Rules for immediate validation does not require any additional data to be collected from the server.

Following rules can be used for immediate validation:

RuleRequiredField

Demands that the Property has a value.

RuleRegularExpression

Validates the value via a regular expression.

RuleStringComparison

Validates the value via a string value compare (Contains, EndsWith, Equals, NotEquals, StartsWith)

RuleValueComparison

Compares the value of e.g. date or an int property (Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals)

RuleRange

Checks if a value is with a specified range.

Immediate validation will cause the red error icon to popup if a property does not meet the rules applied to them.

Detail View Layout

As always, there are a number of updates that contribute to the common good.

Many of us prefer to use the designer (Model Editor) but others rather do it in code... as of now, the detail view can also be modified via Code using the DetailViewLayout attribute.

It's just as simple as this:

public class Contact {
 [Browsable(false)]
 public int ID { get; private set; }

 [DetailViewLayoutAttribute(LayoutColumnPosition.Left)]
 public string FirstName { get; set; }

 [DetailViewLayoutAttribute(LayoutColumnPosition.Right)]
 public string LastName { get; set; }

 [DetailViewLayoutAttribute("FullName", 0)]
 public string FullName { get { return FirstName + " " + LastName; } }

 [DetailViewLayoutAttribute(LayoutColumnPosition.Left)]
 public string Email { get; set; }

 [DetailViewLayoutAttribute(LayoutColumnPosition.Right)]
 public virtual Contact Manager { get; set; }
 [DetailViewLayoutAttribute(LayoutColumnPosition.Left)]
 public DateTime? Birthday { get; set; }

 [FieldSize(FieldSizeAttribute.Unlimited)]
 [DetailViewLayoutAttribute("NotesAndRemarks", LayoutGroupType.TabbedGroup, 100)]
 public string Notes { get; set; }

 [FieldSize(FieldSizeAttribute.Unlimited)]
 [DetailViewLayoutAttribute("NotesAndRemarks", LayoutGroupType.TabbedGroup, 100)]
 public string Remarks { get; set; }
}

Reset View Settings

One of the advantages of using XAF is the option available to the end user to customize views and layouts. From now on, users can restore to the default settings with only a click of a button.

Mind the Gap

While XAF was initially only available with Xpo (the DevExpres ORM), currently EF is supported as well and from my point of view, the GAP is closing fast... :-)

One of the many improvements in 15.2 gives a good example of this.

As an example we will have a look at querying using the ObjectSpace.

Before 15.2, if we would like to linq, we would need something like this:

ObjectQuery<Payment> query = 
((EFObjectSpace)View.ObjectSpace).ObjectContext.CreateQuery<Payment>("Payments");

object obj = query.Where<Payment>(p => p.Hours == 4).FirstOrDefault();

When using Xpo, we would be able to do:

XPQuery<Payment> query = Session.DefaultSession.Query<Payment>();

object obj = query.Where(p => p.Hours == 4).FirstOrDefault();

Both different approaches but with similar result.

As of 15.2, this has been implemented in the IOjbectSpace interface and therefore an identical approach can be used both for Xpo and EF.

var query = ObjectSpace.GetObjectsQuery<Payment>();

object obj = query.Where(p => p.Hours == 4).FirstOrDefault();

For many of you, this might not be a big deal but for me, this makes a difference... KIS.

UX Web Enhancements

In 15.1, the templates were optimised for touch support, in version 15.2 this has been improved and found ready for use in production environments.

Not really using it at the moment but you can read all about is here. The following screenshot also gives a good idea what it is all about.

Why DevExpress?

If you wonder why DevExpress makes a diffierence in my projects, let me explain by a simple example:

Back when I started my last big Xaf project, EF was not supported as it is today, however with the excellent DevExpress support, I was able to incorporate our legacy databases into the XAF Framework. Multiple databases were not supported by Xaf and therefore I presented them my requirements, shortly after, the solution (see schematic below) was implemented followed by a blog post that you can read here.

Wrapping Up

The tip has mainly focussed on XAF, DevExpress 15.2 Universal has much more to offer us. I really enjoyed writing this tip and I hope you find it useful! If not, please let me know!

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Michael Bogaerts
Software Developer 3Way
Belgium Belgium
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 5 Pin
Gittum30-Nov-15 0:07
memberGittum30-Nov-15 0:07 
GeneralRe: My vote of 5 Pin
Michael Bogaerts30-Nov-15 0:46
professionalMichael Bogaerts30-Nov-15 0:46 
GeneralRe: My vote of 5 Pin
_Nizar30-Nov-15 3:58
member_Nizar30-Nov-15 3:58 
GeneralRe: My vote of 5 Pin
Michael Bogaerts30-Nov-15 4:16
professionalMichael Bogaerts30-Nov-15 4:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170915.1 | Last Updated 29 Nov 2015
Article Copyright 2015 by Michael Bogaerts
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid