Smart Design Strategies

Currently, the Xafari.SmartDesign module provides two strategies to generate Views. They are a special Xafari strategy and the default strategy, which generates Views in accordance with the standards of the DevExpress XAF platform. This section describes their features and differences. For specifying the preferred strategy, there is a special SmartDesignStrategyAttribute class. The strategy can be specified in three ways:

  • globally, i.e. for the assembly as a whole; this applies to all included business classes
  • for an individual business class
  • for a specific View (this is described in the Additional Views section below)

The ability to specify a strategy at different levels provides greater flexibility when designing the layout in code. So, you can determine the Xafari strategy at the assembly level, but to cancel it for individual business classes. Or conversely, to specify a Xafari strategy for the required classes, and all the rest will obey to the default DevExpress XAF strategy.

Both strategies are heirs to the SmartDesignStrategyBase class thus, there is a base to implement your own custom strategy and apply it as needed.


The Xafari.SmartDesign.XafariSmartDesignModule.XafSmartDesignStrategyType collection contains those types that use the default XAF settings for the View generation. Please, take this collection intro account when creating your own custom strategies.

The basic idea of the XafSmartDesignStrategy is that XAF generates three Views for each persistent object: List View, Lookup List View, and Detail View. We will call each of them a "default View". Each View contains all of the object's properties. the image below demonstrates the described situation.


XafariSmartDesignStrategy excludes all properties of a persistent object from the default Views. To add a property on the View, you have to apply the corresponding attribute in the business class code. In addition, in the code of this business class, you can declare any number of additional Views, and define the set of displayed properties for each of these Views.

So, see the image above and capture the default View generated by XAF for a business object. Add the Xafari.SmartDesign module and modify the AssemblyInfo.cs file by adding SmartDesignStrategyAttribute with the XafariSmartDesignStrategy parameter.

  • example

 [assembly: SmartDesignStrategy(typeof(XafariSmartDesignStrategy))]

As you can see in the screenshot below, the system generates a default View with no fields.


For demonstration, you can redefine the strategy for the business object by decorating the class with SmartDesignStrategyAttribute in the following manner:

  • c#
  • VB

public class XafarSmartDesignObject : BaseObject

<SmartDesignStrategy(GetType(XafSmartDesignStrategy))> _
Public Class XafarSmartDesignObject
  Inherits BaseObject
End Class

In our case, the default XAF strategy is back again for the XafarSmartDesignObject, now, the Views contain all fields of the object, as can be seen by looking at the screenshot below.


Set the Xafari strategy for the XafarSmartDesignObject class and consider its features. This strategy gives the possibility to customize the default Views and to create new additional Views (both operations should be done in code). This is described in the following sections.


To get acquainted with more advanced customizations, refer to the Xafari.FeatureCenter.XafariSmartDesignGenerator|XafarSmartDesignObject.cs file in the Feature Center demo installed with Xafari. By default, the Feature Center demo is installed in %PUBLIC%\Documents\Xafari Framework v16.1.6011 Demos\FeatureCenter.