eXpress App Framework Team

This Blog

March 2012 - Posts

  • Case Study: Building the Workflow-Based Licensing Application with XAF

    Check out a case study from Nathaniel Laff (you probably already know him from forums, as he always has nice avatarsWinking smile), where he described how he used the Workflow module (shipped as a part of our eXpressApp Framework (XAF) product) for automating the licensing process (tracking customers, orders, software licenses for both trial and licensed users) in his software line (he also posted some screenshots of his application), built using XAF and DevExpress components.

    Here is what Nate said about how the Workflow module helped him:

    “The Workflow module was an amazing addition to the XAF line, and with the small amount of time devoted to getting it up and running, in less than one week I was able to get that time back by not having to use my old techniques for e-mail follow ups, saving me time and massive amounts of energy, while hopefully generating more profits.”

    workflow_design

    Wish to share your story about using our products in your projects and have it appear on our web site?
    Get a case study template and write to us at clientservices@devexpress.com!

    Happy XAFingWinking smile

  • Connecting to any database at runtime

    In this post we will discuss how straight forward is to provide a solution for this science fiction subject! Our frameworks (XAF and XPO) along with a few smart classes are fully capable of doing all the hard job and spare our resources. At the end we will be able to apply all the XAF tools / modules in any legacy database. The module can connect the database world with powerful tools like the DX grids. In addition we can use use XAF’s main metadata storage (the model), the security system and all XAF’s modules. These tools are are so powerful that are able to produce logic by themselves! Having such great configuration flexibility it is possible to write behavior after distribution thus you enter new markets and ideas! In addition the module allows you to control the logic after generation using Xaf’s meta driven developing model.

    Retrieving any database metadata

    XPO is the best candidate for this. since it can transparently talk  to more than 15 different database systems!

    The metadata API used from XPO to describe its supported databases is very simple as shown,

    image

    In a nutshell for each supported database, XPO will return a set of DBTable classes. Each DBTable will be associated with one DBPrimaryKey class and a collection of DBColumn and DBForeighKey classes. Next is the code required to get the DBTable classes out of database and  with no surprise again is very simple!

    var storeSchemaExplorer = ((IDataStoreSchemaExplorer)XpoDefault.GetConnectionProvider("ConnectionString", AutoCreateOption.None));

    var storageTables = storeSchemaExplorer.GetStorageTables(storeSchemaExplorer.GetStorageTablesList());

    foreach (DBTable dbTable in storageTables) {

        foreach (DBColumn dbColumn in dbTable.Columns) {

            //now we are ready to do magic!

        }}

    Connecting at runtime – The magic part

    In order to query and create CRUD operations for a database system XPO requires a set of business classes. However, now there is a runtime factor involved. We need to create these business classes dynamically.

    XAF’s modularized architecture made this task too easy for us! We already created a dynamic class generation module called WorldCreator in the past. WorldCreator maps the structure of an assembly into persistent classes.

    image

    What we need is for each database to create a new PersistentAssemblyInfo, then for each DBTable a new PersistentClassInfo and finally for each DBColumn a new PersistentMemberInfo. In pseudo code this will look like,

    var persistentAssemblyInfo = ObjectSpace.CreateObject<PersistentAssemblyInfo>();

    foreach (DBTable dbTable in storageTables) {

        var persistentClassInfo = ObjectSpace.CreateObject<PersistentClassInfo>();

        persistentAssemblyInfo.Name = dbTable.Name;

        persistentAssemblyInfo.PersistentClassInfos.Add(persistentClassInfo);

        foreach (DBColumn dbColumn in dbTable.Columns) {

            var persistentMemberInfo = ObjectSpace.CreateObject<PersistentMemberInfo>();

            persistentMemberInfo.Name = dbColumn.Name;

            persistentClassInfo.OwnMembers.Add(persistentMemberInfo);

        }

    }

    WorldCreator UI allows further extension of the model as simple as writing .NET code or creating new objects. More ideas and contributions are always welcome.

    Up to this point everything was extremely easy for us and almost shocking in terms of productivity! I believe there is no reason to change that feeling so lets move to our final task.

    WorldCreator is simply a code generation module. It generates assemblies which include XAF modules and loads them at application startup. However that assembly has no difference at all from the assemblies we create at design time. The persistent classes of this dynamic module belong and point back to main XAF database. What we want here is to redirect the generated sql statements back to the original mapped database.

    Once more we have most of the job ready! eXpand already uses a proxy version of ObjectSpaceProvider to support scenarios similar to show Business Classes from several databases in a XAF application. Thus associating a WordCreator assembly (set of business classes) with a database is a rather easy job.

    Connecting to any database at runtime at first sounded very complicated. However our frameworks proved once more that they can raise our productivity and make our jobs so simple that even such complex task can fit in a small post like this one.

    The new module DBMapper, is already released as part of eXpand framework’s modules collection.

    We would appreciate your feedback on this post. Has it been useful to you? Feel free to contact us with any further questions.

LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2017 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners