Blogs

Gary's Blog

February 2011 - Posts

  • XAF Goes to BASTA! Spring 2011

         

    IMG_2068This week Rachel and I have been attending the BASTA! Spring event in Darmstadt, Germany. Whilst smaller than its Summer counterpart, this conference had just as much great content and developer talent as its big brother. As the conference tag line goes: BASTA! .NET, Visual Studio and MORE!

    As a first time presenter at BASTA!, I shared the agenda with some excellent speakers such as Ingo Rammer, Dino Esposito and DevExpress friend, Oliver Sturm. Thanks to all those of your who attended my F# session at 8:30 on Wednesday morning, I hope that you felt you got value from the ideas I presented.

    IMG_2094DevExpress is a perennial exhibitor at the BASTA events and we are always very aware that this is a German language event. With this in mind, we enlisted Oliver’s German language skills to help us to show attendees some of the great stuff you can get with XAF – from using it for basic CRM functionality, through reporting, and finishing up with validation and the new Conditional Appearance capabilities. The reaction to XAF was overwhelmingly positive, and rightly so as its an excellent product.

    We held some daily raffle prize draws after our lunchtime demos. Congratulations to our raffle winners, who included Stefan Behrendt and Rudiger Kugler. We expect great things from you Smile

    More pictures are available on the DevExpress Facebook page for those of you who want to see what you missed.

  • XAF – Domain Components How-to: Implement a Default Property for a Business Entity Derived from Multiple Components

         

    This post may be outdated. For the latest Domain Components concepts and examples refer to the current online documentation.

    In the UI of XAF any object can be represented by a string, called its display name, and you can  easily specify any property as being the display name via DefaultProperty attribute.

    Whilst building the XCRM application, we came across a nice “gotcha” namely, how do you display two or more objects, in a list, if those objects have different default properties? Specifically we ran across this problem whilst implementing Customers.

    First off, we introduced the ICustomer interface with the “contract” that Customers must fulfil:

    [DomainComponent]
    [XafDefaultProperty("Name")]
    public interface ICustomer {
        [PersistentDc]
        string Name { get; }

    As you can see, this interface specifies the “Name” property as being the display name, which seems completely sensible and intuitive. All is okay so far. However, we also have the IPerson and IAccount interfaces. There is also the IContact interface, which inherits from IPerson, ICustomer and IAccount, and it has FullName as its display name:

    [DomainComponent]
    [ImageName("BO_Contact")]
    [XafDefaultProperty("FullName")]
    [VisibleInReports]
    [XafDisplayName("Contact")]
    public interface IContact : IPerson, ICustomer {
        IAccount Account { get; set; }
    }

    And not forgetting IAccount, which inherits from ICustomer, and that uses AccountName as it’s display name:

    [XafDisplayName("Account")]
    public interface IAccount : ICustomer {
        [RuleRequiredField(AccountValidationRules.AccountNameIsRequired, DefaultContexts.Save)]
        string AccountName { get; set; }

    As I’ve said, both of these interfaces inherit from ICustomer, which means we have to work with display names of ICustomer.Name, IContact.FullName and IAccount.AccountName.

    If you are thinking that this is pretty complicated, just wait, it gets worse. There are certain requirements placed on default properties, for example filtering by these properties should be done on the database server and not on the client. Also these properties are likely to be used in criteria and filtering operations, which should be “fast enough” and also not dump half the database onto the client. Smile

    To ensure these performance requirements were met, we added the [Persistent] attribute and removed the setter from the Name member on ICustomer:

    [DomainComponent]
    [XafDefaultProperty("Name")]
    public interface ICustomer {
        [PersistentDc]
        string Name { get; }

    This change made the Name member a calculated property and we need to provide some form of domain logic that will return a meaningful value for it. We don’t provide this logic explicitly for ICustomer, because we don’t know what it will look like. We do know what it should look like in the IAccount subclass however:

    [XafDisplayName("Account")]
    public interface IAccount : ICustomer {
        [RuleRequiredField(AccountValidationRules.AccountNameIsRequired, DefaultContexts.Save)]
        string AccountName { get; set; }

    So in this case, the domain logic for the Name member on ICustomer should return AccountName:

    [DomainLogic(typeof(IAccount))]
    public class AccountLogic {
        public static string Get_Name(IAccount account) {
            return string.Format("{0}", account.AccountName);
        }
    }

    Following this simple pattern, we now know that the domain logic for IContact should return FullName:

    [DomainLogic(typeof(IContact))]
    public class ContactLogic {
        public static string Get_Name(IContact contact) {
            return string.Format("{0}", contact.FullName);
        }
    }

    As you can see from this screen shot, using the pattern defined above, it is easy to have objects with different display names in a single list. Here you can see the “FullName” from the Contact and the “AccountName” (labelled Account) from the Account.

    Contact List

    Well that about wraps it up for this post, if you have any questions or comments please leave them below – until next time, happy XAF’ing! Smile

  • XAF – Mastering Domain Components, a How-to Series

         

    This post may be outdated. For the latest Domain Components concepts and examples refer to the current online documentation.

    A while ago I wrote a blog post detailing the state of Domain Component technology in the 10.2 release. In that blog post I said

    “Meantime, we are also planning to provide a series of in-depth videos and blogs showing, via the XCRM application, how to implement most common business tasks using DC. This should help you see all of the benefits of this technology in action. With the help of XCRM and related learning materials, brand new users will be able to get started with DC faster, whilst advanced users will be able to learn the technology thoroughly.”

    With the exception of the items mentioned here, DC is now completed and it’s time to get cracking with this series! Below you will find a list of the first six “How-tos” that we plan to publish (as we publish them I will update this post to provide links to the relevant posts):

    1. How-to: Implement a default property for a business entity derived from multiple components
    2. How-to: Implement notes functionality in a business entity
    3. How-to: Implement address in a business entity
    4. How-to: Implement calculated properties in a business entity
    5. How-to: Implement a user-friendly identifier in a business entity
    6. How-to: Mix Domain Components & Persistent Classes

    Now, this is where you come in. Obviously our team understand DC completely and know exactly why certain design decision were taken during the creation of the XCRM project this, of course, makes it a little difficult for us to know exactly where the “tricky” areas are going to be for you, when you come to learn DC. In other words we need your advice. We need you to tell us if we are heading in the right direction with the series as far as the first 6 topics are concerned. What changes would you make, if any? What else do you want to see explained?

    Please feel free to leave any comments you may have… well, in the comments. You can also email me directly at garys@devexpress.com if you want to expand on your ideas to an extent that would not easily fit in the comments. Thanks for your help, and we look forward to making this a great series from which you can truly master Domain Components!

    That’s all for this post, until next time, happy XAF’ing! Smile

  • XAF Localization – Help from the Community

         

    XAF Localization – A Little Revision
    Remember a while ago I wrote about localizing applications in 10.2? Well if you don’t, you can refresh your memories by reading these posts:

    New Localization Tool
    Module Localizations Stored in Satellite Assemblies

    But to save you the trouble - and because I want you to read this post and not run off and read ones I’ve already written (and you’ve already read, right? Smile) – I’ll give a quick rundown on what I said. Basically, we provided the capability to localize modules via satellite assemblies, along with providing a localization tool that can perform automatic translations via an online translation service. To supplement this we also provided a knowledge base article which contained ready to use satellite assemblies for many languages as well as a resource for translation of standard XAF modules and our Windows Forms and ASP.Net components.

    Italian and Norwegian Translations Created for XAF
    Having refreshed your memories about what is possible with XAF localization, I’d just like to give a shout out to two XAF users who have followed those instructions to create localizations for their countries:

    Lombardini Massimo  – Italian language;
    Morken Trond  - Norwegian language.

    Thanks guys, we really appreciate it!

    Get Involved in Translating XAF to your Language
    So, if you can already localize the XAF standard modules via the Model Editor and the Localization Tool, what’s the advantage of localizing the resources of the standard XAF modules and then using satellite assemblies created from those resources? Well I’m really glad you asked that question Smile. Actually there are a few reasons for localizing this way, firstly, it is much easier to copy the satellite assemblies than to import and update the current localizations from previous XAF solutions. Secondly, if you use satellite assemblies, either created previously by you or by someone else, then you are only left to localize your own modules. Thirdly, and most importantly maybe, by contributing your assemblies back to the community, you help out your fellow countrymen.

    If you want to help out, and I hope you do, then get a hold of the XafAll.csv file, which is available with the satellite assemblies, and add your language specific translation to the third column, not forgetting to set the column header to the target language code. Thereafter, export the translations from each module in your application, using the Localization Tool, and send the files to our support team and we’ll take care of the rest.

    Well that’s all for this post, until next time, happy XAFing! Smile

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.