in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

Gary's Blog

September 2008 - Posts

  • The Curious Case of the Ketchup and the Missing Booth

    So the BASTA conference wound down with a party and, as with every conference, the organizers tried to give the speakers and exhibitors a gimmicky gift with which to remember the conference by. Now, since the party had a BBQ theme, what better gift that your very own, personalized, bottles of Heinz Tomato Ketchup? And so now, I am the proud owner of my very own ketchup (pictured below).

    P5230084

    At the end of the conference, Oliver and I headed off to the airport. We checked in the Booth (pictured below) and a case containing some left over T-Shirts, CDs and brochures. We duly boarded our flight to London and then caught our connection flight to Edinburgh (ah it was nice to be back in Bonny Scotland). A quick trip to the luggage carrousel, however, showed that our booth was missing. Apparently the baggage handlers and Frankfurt Airport decided that, whilst we probably did need our T-Shirts etc, we could manage without our booth for an extra day or two. So, our booth has been enjoying a couple of days R&R in Germany before deciding to come back home. :-)

    597485

    Digg This
  • Basta Germany Day 3 - XAF, and the Erica Bomb

    Well day three of the conference was good; the delegates seemed a little tired (possibly due to the long hours that they worked at the conference) and they didn't seem much interested in hearing about just how fantastic XAF and XPO are (of course we know that already, right?). So what should a good evangelist do in this situation? We turned on the DevExpress Channel and ran Erica's videos on the plasma screen.

    The effect was almost immediate; people stopped chatting and looked around to watch the screen. I have named this effect the "Erica Bomb", anyone caught in the "blast radius" is compelled to stop what they are doing and watch. I think we'll be using this tatic again in the the future. Wink

  • BASTA Germany Day 2

    It was another brisk day on the booth yesterday. There was a lot of interest in XAF and XPO, as there was on the first day. However, yesterday also saw a lot of interest in our WPF grid, with many people leaving the booth, after the demo, to go and search out the beta version. There was a little interest in the Silverlight grid also, but not so much as in WPF.

    One difference between this conference here in Germany, and events I've attended in the US, is that here in Europe there doesn't seem to be much interest in components for Sharepoint, where as I noticed that was a "big deal" in the US.

    Yesterday afternoon saw quite a bit of interest in CR/R! after one of the speakers (speaking on pragmatic C sharp) told his audience that no one should be programming these days without a tool like ours! Quite a recommendation that sent a number of interested people to the booth.

    Well that is about it from me for now, it's time to get going on day 3 - bye for now.

  • BASTA Germany Day 1

    I am back on the DevExpress booth at the BASTA conference. As I write this Oliver is demo'ng XAF to an eager crowd. I say he's demo'ng XAF, but since it's in German, and I don't speak the language, he could of course be giving them a run down of his favourite bars in the area; hey, maybe that's why they are so interested do you think? Nah, I'm sure it's XAF. Smile

    Seriously, the crowd here just seem to "get" the whole application framework, ORM "thing". Yesterday, whilst Oliver delivered his sessions, I demo'd XAF and a few of our other products (CR/R! always go down well) and even though I was speaking english, the crowd were impressed with the products we have. A couple of them were going to trial XAF on small projects when they got back to their day jobs.

    So, that was yesterday - a pretty fruitful day. Tune in tomorrow to find out what today brings.

  • XAF and XPO in Germany

    Oliver and I are off to the BASTA conference in Germany where we’ll be flying the DevExpress flag. So, as always, if there are any of our customers attending the conference, don’t forget to stop by the booth and say hello – oh, and collect a coveted DevEx T-shirt of course. :-)

    I’m not sure what the connectivity will be like at the conference or at the hotel, so blog postings may be a bit light next week, but if they are, don’t forget you can still keep in contact with me via Twitter at http://www.twitter.com/garyshort

    Anyway, until we return, sit back, relax and help yourself to a beer from the fridge.

    Technorati tags: , ,
    Digg This
  • XAF, XPO and the Squeaky Wheel

    I love my granny, as all of us who are fortunate enough still to have one alive do I’m sure. My granny hails from Highland Perthshire and is, as we say in Scotland, of farming stock; that is to say that, before retiring, she worked a farm, as her forebearers before her did. This means, amongst other things, that she has a wealth of homespun advise, neatly packaged up into handy little sayings, each one perfect for a particular set of circumstances. For example

    “Oh, look at the time and there’s no’ a carrot in the pot!”

    Meaning that the day is slipping away and it looks like I might not get through all the tasks I had allocated to do today, and

    “Behave yersel’ else I’ll come in aboot yer wa’s wi a tarry stick”

    Which means if you do not moderate your bahaviour I’ll beat you about the ribs with the stick I use to stir the molasses for the cattle feed. However, one of my favourites, and one which is somewhat applicable to the situation I now find myself in, is

    “It’s the squeaky wheel that gets the oil”

    Meaning it’s the thing (or person) that makes the most noise (or complains loudest) that gets dealt with fastest. I say it is somewhat applicable to the situation that I now find myself in because, whilst taking my habitual morning “stroll” through our forums, I came across a post, in which the writer was praising Mark’s recent set of posts, showing how to write a plugin using DXCore, and wondering aloud why the XAF team couldn’t be more like Mark, and produce such real world examples.

    Of course, if the writer had appreciated that DXCore and XAF/XPO cannot be compared like for like, he would have been a long way to answering his own question. You see, DXCore is an enabling technology facilitating the creation of a certain type of plugin, it does one thing, and it does it very well and so writing a real world example is easy, as each user’s view of the “world” is the same.

    XAF however, is an application framework, allowing a developer to create winform or webform (or both) applications; it is strategic software that lays out the architectural steps for a developer, the tactical code that the developer then adds to that base, to form the solution to his business problem, is utterly dependent upon a myriad of things:- the industry, the sector of the industry, his company’s view of their market place, financial constraints on his company, financial constraints on his customers, etc, etc, etc; the list goes on and on.

    The point being that there is not one “real world” from which to construct a “real world” example, instead the term takes its definition dependent upon the context of the individual developer. Take me as an example, before joining DevExpress I worked, for 18 years, as a programmer and architect in a number of industries including: Banking, Utilities, FMCG, Pharmaceuticals and Local Government. I can tell you that if you took an application from each of those industries and compared them, they would have little in common. In fact you would have to distil them down to their architectural parts (object persistence, reporting, etc.) before you would find much similarity. So any “real world” example, if it were to be of use to all of our customers equally, can only contain examples of how to use these architectural parts (or product features if you will). It’s no coincidence then, that our MainDemo application demonstrates these product features in a somewhat isolated way, it has to be that way to be of use to our customers as a whole. Again, it is no accident that our documentation takes the same approach of explaining the product features in this way.

    But the “squeaky wheel” says “it’s hard to find information in your documentation”, so I begin a series of cookbook style posts that state a problem, in very simple terms, and then show the solution and a discussion of that solution. The “squeaky wheel” says “these posts are too simplistic” so I suggest a more advanced series, still in the cookbook style, to make it easy to find, called Black Belt XAF and I ask for topic suggestions. The majority of suggestions I receive are not XAF topics but general architectural topics (which I have no objections to covering if that is of benefit to our customers). The “squeaky wheel” says “these examples are not real world”. Although I’ve explained above how it is nearly impossible for us to provide “real world” examples, I decided to start a “Starring You” section in my blog so that actual real world customers can post actual real world examples and they are starting to come through now and yet the post above calls for the XAF team to provide more “real world examples”.

    I contemplated this for a few minutes before I dismissed the idea, I mean how ridiculous. If I were to write a series of blog posts showing how to build a solution from the Banking industry or from the Utilities industry, for example, it would only be useful for a vanishingly small percentage of our customers. Then I thought, wait a minute, maybe this is where I’m going wrong, making assumptions about how useful something would be, why not just ask them? So here we are; the “squeaky wheel” says we need to write a “real world” application and I’m asking you, if I were to create such an application, from start to finish, and even though the chosen industry may have little in common with yours, would that help you? If so, leave a comment below.

    Technorati tags: ,
    Digg This
  • XAF Cookbook #7 – Add Scrollbars to a TextBox in DetailsView

    Problem

    You add a text property to a BO, but you require the user to input a number of lines of text, for example in a description field. By default the DetailsView provides a Textbox showing one line of text entry, you wish to show a number of lines of text entry and have scrollbars if required.

    Solution

    Decorate the text property with the [Size(SizeAttribute.Unlimited)] attribute or set the RowCount property to an appropriate value in the ApplicationModel or, via the Model, change the PropertyEditor type to Memo or RichText.

    Technorati tags:
    Digg This
  • Starring You #2 – Two Way Binding in XPO

    Hard on the heels of his first post, Gary Cox is back again, taking advantage of our “Starring You” slot, to tell us about two way binding in XPO. Remember, if you have a favourite tip or trick and would like to share it with the XAF/XPO community, then mail me at garysATdevexpressDOTcom. Anyway, time for me to shut up and let Gary tell us about two way binding. Take it away Gary.

    In ASP.NET there comes a time when you’re in a situation that you need to store information but not necessarily save it just yet. Or how about binding directly to a persisted object and saving after a series of wizard steps. I wrote a method that handles basically Two-Way Binding in ASP.NET. The issue with ASP.NET is that you can bind a text box to a property; however it will not update the property with the new values. So let’s examine below:

    So let’s say you have FormView with a EditItemTemplate and in the template you created a table that has and ID of “tblMyTemplate” and is set to runat=”server”. To get started, first in our Default.aspx page we get our Business Object ready:

    clip_image002

    Then we are ready to add the rest of our logic into the application, my Form View looks like:

    clip_image004

    Very basic, but will get the point out. Assuming the object is configured correctly we are ready to test our application. I built a basic page that will take the data from my controls, persist them back into my Object which is stored in Session when the Continue Button is clicked. The first parameter of the Recursive Method is your Persistent Business Object (or as in my case XPO). The second parameter is the Parent Control of which the recursive scan will occur.

    clip_image006

    As you can see once I persist the data back to my object, I then change the form back to read only. Here is what is happening behind the scenes:

    I add some data, and click Continue:

    clip_image008

    At first the object properties are empty as you can see:

    clip_image010

    Once the controls have iterated, I get the following:

    clip_image012

    What makes this work is an attribute added to each text box (Or any control) that will be persisted to a property. The attribute is named “tag” and its value must match the Property it is binding too (Case Sensitive). So the text box would like:

    clip_image014

    The Method then recursively looped through the controls I passed it looking for this tag and then with Reflection got the PropertyInfo. (In my example I am only looking at DevExpress controls, you may want to change this to look at System.Web.UI.Control for all others.)

    clip_image016

    It then figured out what kind of control was passed so it could first check if the values match; if so then it doesn’t update the property. It also checked if the property was an Int16 or Int32 so it could convert the values to the properties type.

    clip_image018

    The PropertyType is checked in cases when a developer needs to collect numeric data into a Textbox, but the property will not accept a String value. This can be very helpful and save you a lot of coding when it comes to retrieving your data. I have included the project for your review. The code was compiled using 8.2.3.

    You can download the source code for this example here.

    Technorati tags: ,
    Digg This
  • XAF Cookbook #6 – Programmatically Add a New BO

    Problem

    You have defined a business object and XAF has generated the necessary UI to enable you to carry out CRUD functionality; however, you now wish to be able to add a new instance of the business object programmatically.

    Solution

    In your chosen module, add a controller to the module. Drag a SimpleAction onto the Controller’s design surface. Give the SimpleAction a suitable name and a caption then handle the <SimpleActionName>_Execute event in order to add a new instance of your business object to the View’s ObjectSpace.

    Discussion

    Given the following definition of a business object named Book:-

    using System;
    
    using DevExpress.Xpo;
    
    using DevExpress.ExpressApp;
    using DevExpress.Persistent.Base;
    using DevExpress.Persistent.BaseImpl;
    using DevExpress.Persistent.Validation;
    
    namespace ObjectSpaceExample.Module {
        [DefaultClassOptions]
        public class Book : BaseObject {
            public Book(Session session) : base(session) { }
    
            private string _Author;
            public string Author {
                get {
                    return _Author;
                }
                set {
                    SetPropertyValue("Author", ref _Author, value);
                }
            }
    
            private string _Title;
            public string Title {
                get {
                    return _Title;
                }
                set {
                    SetPropertyValue("Title", ref _Title, value);
                }
            }
    
            private string _Publisher;
            public string Publisher {
                get {
                    return _Publisher;
                }
                set {
                    SetPropertyValue("Publisher", ref _Publisher, value);
                }
            }
    
        }
    
    }

    Assuming we now wish to add an instance of this business object programmatically, add a ViewController to the module and drag a SimpleAction onto the design surface. Handle the Execute event of the SimpleAction to add the new instance.

    using System;
    using System.ComponentModel;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Text;
    
    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Actions;
    using DevExpress.Persistent.Base;
    
    namespace ObjectSpaceExample.Module {
        public partial class BookController : ViewController {
            public BookController() {
                InitializeComponent();
                RegisterActions(components);
            }
    
            private void AddBookAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
                Book book = View.ObjectSpace.CreateObject<Book>();
                book.Author = "Me";
                book.Title = "A Book by Me";
                book.Publisher = "Me";
                View.ObjectSpace.CommitChanges();
                View.ObjectSpace.Refresh();
            }
        }
    }

    Points to note: we use the View’s ObjectSpace to create the new instance of our business object, committing changes when we have done so to persist the object and then calling Refresh() on the ObjectSpace to refresh the View. You can read more about ObjectSpace in our documentation.

    Technorati tags: ,
    Digg This
  • Starring You #1 – XPO and Membership

    In the first of our “Starring You” slots, Gary Cox shows us how to use the email address as the user name when using XPO. Don’t forget, if you have a great XPO or XAF tip that you think other users could benefit from and you’d like your name “up in lights”, then drop me an email at garysATdevexpressDOTcom with your idea.

    Now, without further ado, I’ll let Gary tell us about membership and XPO.

    Everyone wants to keep things simple, and when it comes to Membership following the standards will keep things simple. However, since we use XPO, the standards can still be followed but , at the same time, we can apply our own signature to our work. I use XPO and needed to handle Membership and Roles within my application. So to make a long story short I implemented this and wanted to share with you guys. In my case I needed to provide the ability to either use the User Name as the User Name or the Email Address field as the User Name. What this means is, if you use the standard .NET Membership controls and if useEmailAsUserName is true, then the code will expect an email address instead of the User Name. I made this a setting in the web.config.

    Membership is configured like so:

    <membership defaultProvider="PersistentMembership">
      <providers>
        <add name="PersistentMembership" 
             type="Persistent.Membership.PersistentMembershipProvider, Persistent.Membership" 
             useEmailAsUserName="false" />
      </providers>
    </membership>

    Role Manager is configured like so:

    <roleManager defaultProvider="UserRolesProvider"
                     enabled="true"
                     cacheRolesInCookie="true"
                     cookieName=".ASPROLES"
                     cookiePath="/"
                     cookieTimeout="30"
                     cookieRequireSSL="false"
                     cookieSlidingExpiration="true"
                     cookieProtection="All"
                     >
      <providers>
        <clear />
        <add name="UserRolesProvider"
             type="Persistent.Membership.UserRolesProvider, Persistent.Membership"
             applicationName="PersistentRoles"
             writeExceptionsToEventLog="false" />
      </providers>
    </roleManager>

    I hope this helps at least one person and if you have any problems please let me know and I will assist you in correcting them. By the way, this was compiled with 8.2.3. You can download the code from here.

    Digg This
  • XAF Cookbook #5 – Customise Your Default BO Images

    Problem

    You wish to substitute the default image, for a business object, with a custom one of your own.

    Solution

    Create two images one 16X16, the other 32X32, name the smaller one with the name of your business object and the larger one with the name of your business object with “_Large” appended to it. In the module where you created your business object, create a folder named “Images”. Add both of your images to this folder and include them in the project. Set both the image’s “Build Action” properties to “Embedded Resource”. Next, open the model editor and navigate to Application –> BOModel –> <your BO name> and set the “ImageName” property to the name of your BO. Save the model. Run your application again and the default images in both the navbar and the icon for the the details view window will have been replaced.

    Discussion

    Although you can use any type of graphics file, the png format is best because of its support for the alpha channel. Also, if you use image sizes other than 16X16 and 32X32 the image will be resized for the details view window icon, but not for the navbar image. Further details can be found here.

    Technorati tags:
    Digg This
  • Guest Starring…You?

    while I’m busy pushing out the XAF and XPO cookbooks and the more advanced version, which I’ve decided to call Black Belt XAF/XPO for no other reason that it makes me sound tough; it occurred to me, that as you guys are the ones who are using the products in production on a daily basis, then you’d probably have a wealth of tips ‘n’ tricks that the community could benefit from. That being the case, I’m starting a “guest blogger” slot on my blog for anyone who has any XAF/XPO insights that they’d like to share with us all. If that sounds like you, and you’d like a “guest blogger” slot then email me at garysAtdevexpressDOTcom with your entry and I’ll publish it, along with a link to your blog.

    Digg This
  • XAF Cookbook #4 – Customise the Default Detail View for Your BO

    Problem

    You have created you own custom business object but you do not like the default layout of the details view.

    Solution

    Use the Model Editor (either at design time or runtime) or access the Layout Control in code to affect the required changes.

    Discussion

    At design time, open the Model Editor and navigate to the Views –> YourBO_DetailsView –> Layout node. Right click on the right hand pane and select “Customize Layout”. Drag and drop the elements where they are required.

    At runtime select Tools –> Model Editor and follow the steps above.

    You can also access the Layout Control in code and affect the changes you require.

    Full details of these three options can be found in our documentation.

    Technorati tags:
    Digg This
  • Advanced XAF You Say?

    So this morning I received an email which basically said

    “Hey, stop writing basic stuff on XPO and XAF and start writing about the advanced stuff that I need to know about. The community can look after the noobs, but you need to start looking after those of us who’ve been doing this for a while.”

    The author makes a valid point. Although I’m not going to stop writing the XAF and XPO cookbooks for two reasons; firstly, if you are going to write a cookbook it needs to cover everything and that includes the basics to begin with, and secondly, the “community” may not reply to a new customer in quite the tone that DevExpress would hope for, if you know what I mean ;-)

    Having said that, there is no reason why I can’t write a more advanced series in parallel and that is what this post is about. The term “advanced topics” doesn’t help me know what information you want. So, would you like to see an article on a particular topic that you consider to be “advanced”? If so, leave a comment and I’ll take a look at it. In the meantime, I replied to the author of the email asking for his top three topics as somewhere for me to start, so look out for this series coming in parallel with the cookbook stuff.

    As an aside, what is a more advanced version of a cookbook called? Send me your ideas for a title, there’s no prize, just the honour and the glory of naming the series. :-)

    Digg This
  • XAF Cookbook #3 – Manage Your Custom Business Objects

    Problem

    You wish to create a win form and web form application to manage CRUD operations for your custom business objects.

    Solution

    Create an application, add a DomainObject, define your object’s properties and XAF will, by default, create a web form and win form application to manage the CRUD operations.

    Discussion

    Once you have created your XAF application, add a new business object by right clicking on the <solutionName>.Module project and clicking the Add –> New Item… menu option. From the dialog select DomainObject V8.2, name it appropriately and press “Add”.

    Next add the properties you require, in this case Name, Address and TelephoneNumber (using the CR template “XPS”) and your code will look like this:-

    using System;
    
    using DevExpress.Xpo;
    
    using DevExpress.ExpressApp;
    using DevExpress.Persistent.Base;
    using DevExpress.Persistent.BaseImpl;
    using DevExpress.Persistent.Validation;
    
    namespace XAFCookbook_003.Module {
        [DefaultClassOptions]
        public class Library : BaseObject {
            public Library(Session session) : base(session) { }
    
            private string _Name;
            public string Name {
                get {
                    return _Name;
                }
                set {
                    SetPropertyValue("Name", ref _Name, value);
                }
            }
    
            private string _Address;
            public string Address {
                get {
                    return _Address;
                }
                set {
                    SetPropertyValue("Address", ref _Address, value);
                }
            }
    
            private string _TelephoneNumber;
            public string TelephoneNumber {
                get {
                    return _TelephoneNumber;
                }
                set {
                    SetPropertyValue("TelephoneNumber", ref _TelephoneNumber, value);
                }
            }
    
    
        }
    
    }

    Now, press F5 to launch your application and you will see that XAF has, by default, created a UI that will allow you to perform CRUD operations on your custom business object.

    Technorati tags:
    Digg This
More Posts Next page »
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED