<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.devexpress.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Gary's Blog</title><link>http://community.devexpress.com/blogs/garyshort/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 SP1 (Build: 30415.43)</generator><item><title>XPO Cookbook #5 – Creating Persistent Objects for an Existing Database</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/28/xpo-cookbook-5-creating-persistent-objects-for-an-existing-database.aspx</link><pubDate>Thu, 28 Aug 2008 15:59:05 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:232816</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=232816</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/28/xpo-cookbook-5-creating-persistent-objects-for-an-existing-database.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You have an existing database for which you have to create an application and so wish to create a set of persistent objects to reflect the table(s) you have to work with.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Use the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=customdocument3334.htm"&gt;PersistantClasses Wizard&lt;/a&gt; to generate the classes for you, then use as normal.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;AdventureWorks;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Data.Filtering;

&lt;span style="color:blue;"&gt;class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Program &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args) {
        &lt;span style="color:green;"&gt;//GS - Create and save a contact
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;()) {
            &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person_Contact&lt;/span&gt;() {
                FirstName = &lt;span style="color:#a31515;"&gt;&amp;quot;Gary&amp;quot;&lt;/span&gt;,
                LastName = &lt;span style="color:#a31515;"&gt;&amp;quot;Short&amp;quot;
            &lt;/span&gt;}.Save();
            uow.CommitChanges();
        }

        &lt;span style="color:green;"&gt;//GS - Read the contact back to prove it is persisted
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;()) {
            &lt;span style="color:#2b91af;"&gt;Person_Contact &lt;/span&gt;contact = 
                uow.FindObject&amp;lt;&lt;span style="color:#2b91af;"&gt;Person_Contact&lt;/span&gt;&amp;gt;(
                    &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BinaryOperator&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Gary&amp;quot;&lt;/span&gt;));

            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(contact != &lt;span style="color:blue;"&gt;null&lt;/span&gt;) {
                &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#2b91af;"&gt;String&lt;/span&gt;.Format(
                    &lt;span style="color:#a31515;"&gt;&amp;quot;Contact first name {0} has been written to the database&amp;quot;&lt;/span&gt;,
                        contact.FirstName));
            };
        }

        &lt;span style="color:green;"&gt;//GS - Reset database
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;()) {
            &lt;span style="color:#2b91af;"&gt;Person_Contact &lt;/span&gt;contact = 
                uow.FindObject&amp;lt;&lt;span style="color:#2b91af;"&gt;Person_Contact&lt;/span&gt;&amp;gt;(
                    &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BinaryOperator&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Gary&amp;quot;&lt;/span&gt;));

            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(contact != &lt;span style="color:blue;"&gt;null&lt;/span&gt;) {
                uow.Delete(contact);
                uow.CommitChanges();
            }
        }
    }    
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The PersistentClasses Wizard will allow you to select the table(s) and field(s) you wish to select from your existing database; it will then generate persistent class(es), for the selected items, in a single class, thus not polluting your project if you have generated dozens of classes. In the example above I generated the Person.Contact table from the &lt;a href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004"&gt;AdventureWorks&lt;/a&gt; sample database.&lt;/p&gt;

&lt;p&gt;From here, you can either use the classes as normal (as per the example above) or you can subclass one or more of these generated classes and place your business logic and any non persistent properties in these subclasses.&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f180a3f7-0bac-492f-9c13-877d72cb09c9" class="wlWriterSmartContent"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO+Cookbook" rel="tag"&gt;XPO Cookbook&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f28%2fxpo-cookbook-5-creating-persistent-objects-for-an-existing-database.aspx&amp;amp;title=XPO+Cookbook+%235+%e2%80%93+Creating+Persistent+Objects+for+an+Existing+Database"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=232816" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO+Cookbook/default.aspx">XPO Cookbook</category></item><item><title>XPO Cookbook #4 – Persisting an Existing Hierarchy by Implementing Interfaces</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/27/xpo-cookbook-4-persisting-an-existing-hierarchy-by-implementing-interfaces.aspx</link><pubDate>Wed, 27 Aug 2008 12:50:17 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:232608</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=232608</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/27/xpo-cookbook-4-persisting-an-existing-hierarchy-by-implementing-interfaces.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You want to use XPO as an ORM tool. You have an existing hierarchy of business objects that you wish to persist, but you want a more flexible solution than that provided by using attributes.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Assume we have the very simplistic business object below:-&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Make;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Make {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Make; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Make = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Model;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Model {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Model; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Model = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Car() {
        
    }
}&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;After the required modifications, and the addition of some code to test it, the example now looks like this:-&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo.Metadata;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Collections;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Data.Filtering;


&lt;span style="color:blue;"&gt;class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Program &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args) {
        &lt;span style="color:green;"&gt;//GS - Test our hierarchy is now persistent

        //GS - Create and save a Car
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;()) {
            &lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;car = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Car&lt;/span&gt;(uow) {
                Make = &lt;span style="color:#a31515;"&gt;&amp;quot;Ford&amp;quot;&lt;/span&gt;,
                Model = &lt;span style="color:#a31515;"&gt;&amp;quot;Fiesta&amp;quot;
            &lt;/span&gt;};
            car.Save();
            uow.CommitChanges();
        }

        &lt;span style="color:green;"&gt;//GS - Read back the car
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;()) {
            &lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;car = FindCarByMake(&lt;span style="color:#a31515;"&gt;&amp;quot;Ford&amp;quot;&lt;/span&gt;, uow);
            &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#2b91af;"&gt;String&lt;/span&gt;.Format(
                &lt;span style="color:#a31515;"&gt;&amp;quot;Make = {0}, Model = {1}&amp;quot;&lt;/span&gt;, 
                car.Make, 
                car.Model));
        }

        &lt;span style="color:green;"&gt;//GS - Delete the Car
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;()) {
            &lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;car = FindCarByMake(&lt;span style="color:#a31515;"&gt;&amp;quot;Ford&amp;quot;&lt;/span&gt;,uow);
            car.Delete();
            uow.CommitChanges();
        }

        &lt;span style="color:green;"&gt;//GS - Prove the car has been deleted
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;())
        {
            &lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;car = FindCarByMake(&lt;span style="color:#a31515;"&gt;&amp;quot;Ford&amp;quot;&lt;/span&gt;,uow);
            &lt;span style="color:blue;"&gt;if&lt;/span&gt;(car == &lt;span style="color:blue;"&gt;null&lt;/span&gt;){
                &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Car has been deleted!&amp;quot;&lt;/span&gt;);
            }

            &lt;span style="color:blue;"&gt;else&lt;/span&gt;{
                &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Something went wrong!&amp;quot;&lt;/span&gt;);
            }
        }
    }

    &lt;span style="color:blue;"&gt;private static &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;FindCarByMake(&lt;span style="color:blue;"&gt;string &lt;/span&gt;make, &lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow) {
        &lt;span style="color:#2b91af;"&gt;BinaryOperator &lt;/span&gt;bo = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;BinaryOperator&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Make&amp;quot;&lt;/span&gt;, make);
        &lt;span style="color:blue;"&gt;return &lt;/span&gt;uow.FindObject&amp;lt;&lt;span style="color:#2b91af;"&gt;Car&lt;/span&gt;&amp;gt;(bo);
    }
}

&lt;span style="color:green;"&gt;//GS - Create an existing hierarchy
&lt;/span&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Car &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;IXPObject&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;IComparable &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Make;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Make {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Make; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Make = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
            OnChanged(&lt;span style="color:#a31515;"&gt;&amp;quot;Make&amp;quot;&lt;/span&gt;);
        }
    }

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Model;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Model {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Model; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Model = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
            OnChanged(&lt;span style="color:#a31515;"&gt;&amp;quot;Model&amp;quot;&lt;/span&gt;);
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Car() {
        
    }

    &lt;span style="color:green;"&gt;//GS - Provide an Id for our object
    &lt;/span&gt;&lt;span style="color:blue;"&gt;private int &lt;/span&gt;_Id;
    [&lt;span style="color:#2b91af;"&gt;Key&lt;/span&gt;(&lt;span style="color:blue;"&gt;true&lt;/span&gt;)]
    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Id {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Id; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Id = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
            OnChanged(&lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;);
        }
    } 

    &lt;span style="color:green;"&gt;//GS - Provide a backing store for Session and ClassInfo
    &lt;/span&gt;&lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Session &lt;/span&gt;_Session;
    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XPClassInfo &lt;/span&gt;_ClassInfo;

    &lt;span style="color:green;"&gt;//GS - Provide a constructor for our object that takes a Session object
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;Car(&lt;span style="color:#2b91af;"&gt;Session &lt;/span&gt;session) {
        _Session = session;
        _ClassInfo = session.Dictionary.GetClassInfo(&lt;span style="color:blue;"&gt;this&lt;/span&gt;.GetType());
        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!IsLoading)
            AfterConstruction();
    }       

    &lt;span style="color:green;"&gt;//GS - Write any post construction code here
    &lt;/span&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;AfterConstruction() { }

    &lt;span style="color:green;"&gt;//GS - Create a backing store and a property for the IsLoading bool
    &lt;/span&gt;&lt;span style="color:blue;"&gt;bool &lt;/span&gt;_IsLoading;
    [&lt;span style="color:#2b91af;"&gt;NonPersistent&lt;/span&gt;]
    &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsLoading { &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_IsLoading; } }
    
    &lt;span style="color:green;"&gt;//GS - Define the Changed event
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public event &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObjectChangeEventHandler &lt;/span&gt;Changed;

    &lt;span style="color:green;"&gt;//GS - Raise the Change event
    &lt;/span&gt;&lt;span style="color:blue;"&gt;protected void &lt;/span&gt;RaiseChangeEvent(&lt;span style="color:#2b91af;"&gt;ObjectChangeEventArgs &lt;/span&gt;args) {
        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(Changed != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)
            Changed(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, args);
    }

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnChanged() {
        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!IsLoading)
            RaiseChangeEvent(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObjectChangeEventArgs&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;ObjectChangeReason&lt;/span&gt;.Reset));
    }

    &lt;span style="color:blue;"&gt;protected void &lt;/span&gt;OnChanged(&lt;span style="color:blue;"&gt;string &lt;/span&gt;propertyName) {
        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(!IsLoading)
            RaiseChangeEvent(
                &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObjectChangeEventArgs&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;ObjectChangeReason&lt;/span&gt;.PropertyChanged,
                    propertyName));
    }

    &lt;span style="color:green;"&gt;//GS - Provide general persistence methods
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public void &lt;/span&gt;Save() {
        Session.Save(&lt;span style="color:blue;"&gt;this&lt;/span&gt;);
    }

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;Delete() {
        Session.Delete(&lt;span style="color:blue;"&gt;this&lt;/span&gt;);
        RaiseChangeEvent(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObjectChangeEventArgs&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;ObjectChangeReason&lt;/span&gt;.Delete));

    }

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;Reload() {
        Session.Reload(&lt;span style="color:blue;"&gt;this&lt;/span&gt;);
        RaiseChangeEvent(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ObjectChangeEventArgs&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;ObjectChangeReason&lt;/span&gt;.Reset));
    }    

    &lt;span style="color:blue;"&gt;#region &lt;/span&gt;IXPObject Members

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnDeleted() {}

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnDeleting() {}

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnLoaded() {
        _IsLoading = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;
    }

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnLoading() {
        _IsLoading = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;
    }

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnSaved() {}

    &lt;span style="color:blue;"&gt;public void &lt;/span&gt;OnSaving() {}

    &lt;span style="color:blue;"&gt;#endregion

    #region &lt;/span&gt;IXPClassInfoProvider Members

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XPClassInfo &lt;/span&gt;ClassInfo {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_ClassInfo; }
    }

    &lt;span style="color:blue;"&gt;#endregion

    #region &lt;/span&gt;IXPDictionaryProvider Members

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XPDictionary &lt;/span&gt;Dictionary { &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;Session.Dictionary; } }

    &lt;span style="color:blue;"&gt;#endregion

    #region &lt;/span&gt;ISessionProvider Members

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Session &lt;/span&gt;Session {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Session; }
    }

    &lt;span style="color:blue;"&gt;#endregion

    #region &lt;/span&gt;IDataLayerProvider Members

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IDataLayer &lt;/span&gt;DataLayer {&lt;span style="color:blue;"&gt;get &lt;/span&gt;{&lt;span style="color:blue;"&gt;return &lt;/span&gt;Session.DataLayer;}}

    &lt;span style="color:blue;"&gt;#endregion

    #region &lt;/span&gt;IComparable Members

    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;CompareTo(&lt;span style="color:blue;"&gt;object &lt;/span&gt;obj) {
        &lt;span style="color:blue;"&gt;return &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Comparer&lt;/span&gt;.Default.Compare(Session.GetKeyValue(&lt;span style="color:blue;"&gt;this&lt;/span&gt;),
          Session.GetKeyValue(obj &lt;span style="color:blue;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IXPSimpleObject&lt;/span&gt;));
    }

    &lt;span style="color:blue;"&gt;#endregion
&lt;/span&gt;}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To make an existing hierarchy persistent, using interfaces, the first thing we do is to modify the the class definition so that it implements the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=clsdevexpressxpoixpobjecttopic.htm"&gt;IXPObject&lt;/a&gt; and IComparable interfaces. Then we add a property to hold the Id of the object (note the use of the key attribute to specify that the key should be auto generated), and implement change notification in that property and the other properties already defined in our class.&lt;/p&gt;

&lt;p&gt;Following that we create a backing store for the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=XPO&amp;amp;document=clsDevExpressXpoSessiontopic.htm"&gt;Session&lt;/a&gt; and &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=clsdevexpressxpometadataxpclassinfotopic.htm"&gt;ClassInfo&lt;/a&gt; objects and implement a constructor, for our class, that sets those fields. We also, at this point, provide a hook for developers to place any intialisation code that must be run post construction.&lt;/p&gt;

&lt;p&gt;The next thing we do is to code the change notification that we called from our properties when we made those changes above, before coding the general persistence methods of Save(), Reload() and Delete().&lt;/p&gt;

&lt;p&gt;This completes the work we have to do on our own class, and all that remains for us to do is to implement the methods required by the interfaces.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:56758a88-86fa-4596-bac3-d101671b1585" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO+Cookbook" rel="tag"&gt;XPO Cookbook&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f27%2fxpo-cookbook-4-persisting-an-existing-hierarchy-by-implementing-interfaces.aspx&amp;amp;title=XPO+Cookbook+%234+%e2%80%93+Persisting+an+Existing+Hierarchy+by+Implementing+Interfaces"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=232608" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO+Cookbook/default.aspx">XPO Cookbook</category></item><item><title>XPO Cookbook #3 – Persist an Existing Hierarchy Using Attributes</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/26/xpo-cookbook-3-persist-an-existing-hierarchy-using-attributes.aspx</link><pubDate>Tue, 26 Aug 2008 15:53:20 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:232484</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=232484</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/26/xpo-cookbook-3-persist-an-existing-hierarchy-using-attributes.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You wish to use XPO as an ORM tool. You have an existing hierarchy of business objects and you do not wish to implement any extra interfaces.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Assume you have the following hierarchy of business objects where Employee inherits from Person:-&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:green;"&gt;//GS - Create an existing hierarchy&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Name;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Name {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Name; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Name = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }

    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;_DateOfBirth;
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;DateOfBirth {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_DateOfBirth; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _DateOfBirth = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Person() {
        
    }
}

&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Employee &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_EmployeeNumber;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;EmployeeNumber {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_EmployeeNumber; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _EmployeeNumber = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Employee() {
        
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;After adding support for XPO the hierarchy will look like this:-&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color:#2b91af;"&gt;Persistent&lt;/span&gt;]
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private int &lt;/span&gt;_Id;
    [&lt;span style="color:#2b91af;"&gt;Key&lt;/span&gt;(&lt;span style="color:blue;"&gt;true&lt;/span&gt;)]
    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Id {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Id; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Id = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Name;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Name {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Name; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Name = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }

    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;_DateOfBirth;
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;DateOfBirth {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_DateOfBirth; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _DateOfBirth = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Person() {
        
    }
}

[&lt;span style="color:#2b91af;"&gt;Persistent&lt;/span&gt;]
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Employee &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_EmployeeNumber;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;EmployeeNumber {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_EmployeeNumber; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _EmployeeNumber = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Employee() {
        
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Creating, modifying and saving objects from this hierarchy are now done in the same way as if the objects inherited from one of the XPO classes in the first place. The full example now looks like this:-&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo;


&lt;span style="color:blue;"&gt;class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Program &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args) {
        &lt;span style="color:#2b91af;"&gt;XpoDefault&lt;/span&gt;.Session.Save(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Employee&lt;/span&gt;() { 
            Name=&lt;span style="color:#a31515;"&gt;&amp;quot;Gary&amp;quot;&lt;/span&gt;,
            DateOfBirth = &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt;.Parse(&lt;span style="color:#a31515;"&gt;&amp;quot;24/01/1970&amp;quot;&lt;/span&gt;),
            EmployeeNumber = &lt;span style="color:#a31515;"&gt;&amp;quot;RA 1234&amp;quot;
        &lt;/span&gt;});
    }
}

[&lt;span style="color:#2b91af;"&gt;Persistent&lt;/span&gt;]
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private int &lt;/span&gt;_Id;
    [&lt;span style="color:#2b91af;"&gt;Key&lt;/span&gt;(&lt;span style="color:blue;"&gt;true&lt;/span&gt;)]
    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Id {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Id; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Id = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_Name;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Name {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_Name; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _Name = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }

    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;_DateOfBirth;
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;DateOfBirth {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_DateOfBirth; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _DateOfBirth = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Person() {
        
    }
}

[&lt;span style="color:#2b91af;"&gt;Persistent&lt;/span&gt;]
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Employee &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;{

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_EmployeeNumber;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;EmployeeNumber {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;_EmployeeNumber; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            _EmployeeNumber = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;
        }
    }
    
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Employee() {
        
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To enable the initial object hierarchy to be persisted by XPO the following steps were carried out:-&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=XPO&amp;amp;document=clsDevExpressXpoPersistentAttributetopic.htm"&gt;Persistent&lt;/a&gt; attribute was added to both the Person and the Employee Classes.&lt;/li&gt;

  &lt;li&gt;A new property (Id) was added to Person (this is inherited by Employee).&lt;/li&gt;

  &lt;li&gt;The &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=clsdevexpressxpokeyattributetopic.htm"&gt;Key&lt;/a&gt; attribute was added to the Id property and a boolean parameter of true was passed to it to indicate that the key should be generated automatically.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c97f06e1-f287-4122-b21e-b738cea224bf" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO+Cookbook" rel="tag"&gt;XPO Cookbook&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f26%2fxpo-cookbook-3-persist-an-existing-hierarchy-using-attributes.aspx&amp;amp;title=XPO+Cookbook+%233+%e2%80%93+Persist+an+Existing+Hierarchy+Using+Attributes"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=232484" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO/default.aspx">XPO</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO+Cookbook/default.aspx">XPO Cookbook</category></item><item><title>XPO Cookbook #2 – Change the Default Database</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/25/xpo-cookbook-2-change-the-default-database.aspx</link><pubDate>Mon, 25 Aug 2008 15:22:04 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:232303</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=232303</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/25/xpo-cookbook-2-change-the-default-database.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You want to persist your objects to a MS SQL Server database instead of the default access database&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo.DB;

&lt;span style="color:blue;"&gt;class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Program &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args) {
        &lt;span style="color:blue;"&gt;string &lt;/span&gt;conn =
            &lt;span style="color:#2b91af;"&gt;MSSqlConnectionProvider&lt;/span&gt;.GetConnectionString(&lt;span style="color:#a31515;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;,
                &lt;span style="color:#a31515;"&gt;&amp;quot;XPOCookbook&amp;quot;&lt;/span&gt;);

        &lt;span style="color:#2b91af;"&gt;XpoDefault&lt;/span&gt;.DataLayer =
            &lt;span style="color:#2b91af;"&gt;XpoDefault&lt;/span&gt;.GetDataLayer(conn,
                &lt;span style="color:#2b91af;"&gt;AutoCreateOption&lt;/span&gt;.DatabaseAndSchema);
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To connect to a SQL Server database, instead of the default Access database, the first thing that we have to do is to create the required connection string by calling the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=XPO&amp;amp;document=DevExpressXpoDBMSSqlConnectionProvider_GetConnectionStringtopic.htm"&gt;GetConnectionString()&lt;/a&gt; method on the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=clsdevexpressxpodbmssqlconnectionprovidertopic.htm"&gt;MSSqlConnectionProvider&lt;/a&gt; class and passing in the server name and database name. Having thus obtained the connection string, we can then make our database the default one used by XPO by setting the XpoDefault &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=devexpressxpoxpodefault_datalayertopic.htm"&gt;DataLayer&lt;/a&gt; property to the result of calling the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=XPO&amp;amp;document=DevExpressXpoXpoDefault_GetDataLayertopic.htm"&gt;GetDataLayer()&lt;/a&gt; method, on the XpoDefault class, passing in the connection string and setting the &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=XtraData&amp;amp;document=DevExpressXpoDBAutoCreateOptionEnumtopic.htm"&gt;AutoCreateOption&lt;/a&gt;.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:167ef1e8-d19d-4b94-89b7-7639fe5df94d" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO+Cookbook" rel="tag"&gt;XPO Cookbook&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f25%2fxpo-cookbook-2-change-the-default-database.aspx&amp;amp;title=XPO+Cookbook+%232+%e2%80%93+Change+the+Default+Database"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=232303" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO/default.aspx">XPO</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO+Cookbook/default.aspx">XPO Cookbook</category></item><item><title>XPO Cookbook #1 – Quickly Serialise an Object</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/25/xpo-cookbook-1-quickly-serialise-an-object.aspx</link><pubDate>Mon, 25 Aug 2008 11:46:46 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:232257</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=232257</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/25/xpo-cookbook-1-quickly-serialise-an-object.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You want to serialise an object as quickly as possible and you have no preference as to which RDBMS is used.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo;

&lt;span style="color:blue;"&gt;class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Program &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args) {
        &lt;span style="color:green;"&gt;//GS - Create a unit of work to work within
        &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;UnitOfWork &lt;/span&gt;uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;UnitOfWork&lt;/span&gt;())
        {
            &lt;span style="color:green;"&gt;//GS - Create and serialize a person
            &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;person = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person&lt;/span&gt;(uow) { 
                FistName = &lt;span style="color:#a31515;"&gt;&amp;quot;Gary&amp;quot;&lt;/span&gt;, 
                LastName = &lt;span style="color:#a31515;"&gt;&amp;quot;Short&amp;quot;&lt;/span&gt;, 
                DateOfBirth = &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt;.Parse(&lt;span style="color:#a31515;"&gt;&amp;quot;24/01/1970&amp;quot;&lt;/span&gt;) 
            };

            uow.CommitChanges();
        }
    }
}

&lt;span style="color:green;"&gt;//GS - Define a Person Class
&lt;/span&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;XPObject &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Person(&lt;span style="color:#2b91af;"&gt;Session &lt;/span&gt;session)
        : &lt;span style="color:blue;"&gt;base&lt;/span&gt;(session) { }

    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_FistName;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;FistName {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{
            &lt;span style="color:blue;"&gt;return &lt;/span&gt;_FistName;
        }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            SetPropertyValue(&lt;span style="color:#a31515;"&gt;&amp;quot;FistName&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;_FistName, &lt;span style="color:blue;"&gt;value&lt;/span&gt;);
        }
    }
    &lt;span style="color:blue;"&gt;private string &lt;/span&gt;_LastName;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;LastName {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{
            &lt;span style="color:blue;"&gt;return &lt;/span&gt;_LastName;
        }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            SetPropertyValue(&lt;span style="color:#a31515;"&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;_LastName, &lt;span style="color:blue;"&gt;value&lt;/span&gt;);
        }
    }
    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;_DateOfBirth;
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;DateTime &lt;/span&gt;DateOfBirth {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{
            &lt;span style="color:blue;"&gt;return &lt;/span&gt;_DateOfBirth;
        }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{
            SetPropertyValue(&lt;span style="color:#a31515;"&gt;&amp;quot;DateOfBirth&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;_DateOfBirth, &lt;span style="color:blue;"&gt;value&lt;/span&gt;);
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first thing to notice is that I have more than one class defined in my source file. Such things are normally frowned upon in favour of a “one class, one file” mantra, and rightly so. However, I am not writing an application for production here, I’m writing code for a blog post and it makes it easier to discuss if all the code is displayed; it also makes it easier for you to cut, paste and run the example if you so wish. I will be defining all my classes in the one source file for all of the recipes in this cookbook, but I will only be explaining the rationale once. If you wish, you may take bets on how far into the cookbook I get before someone comments along the lines of “shouldn’t you have one file per class?”. When they do, the reader who guessed closest to the recipe number wins; when it happens you can also point the commenter here for an explanation. :-)&lt;/p&gt;

&lt;p&gt;Anyway, on to the explanation of the recipe. Firstly let’s chat about the business object we have created for serialisation. The first thing to notice is that our class inherits from &lt;a href="http://www.devexpress.com/Help/?document=xpo/clsdevexpressxpoxpobjecttopic.htm&amp;amp;levelup=true"&gt;XPObject&lt;/a&gt;, one of three classes that your business objects can inherit from when using XPO, more on the other two in future recipes. XPObject gives us support for unique keys and optimistic locking out of the box and is the class inherited from if you use the &lt;a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/"&gt;CodeRush&lt;/a&gt; template to create your business object. The CodeRush template is the recommended way to create such business classes and is the route I always take. The mnemonic for this template is “xc”.&lt;/p&gt;

&lt;p&gt;The next thing to notice about our business object is the setter for the properties uses the SetPropertyValue method, this allows XPO to handle change management for you and is one less thing for you to worry about. The CodeRush templates for adding these properites (“xps” for string properties and “xpd8” for the DateTime property) adds the call to SetPropertyValue for you and is, again, the recommended route.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;To make use of our business object we create a &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=xpo&amp;amp;document=customdocument2138.htm"&gt;UnitOfWork&lt;/a&gt;. The UnitOfWork inherits from &lt;a href="http://www.devexpress.com/Help/Content.aspx?help=XPO&amp;amp;document=CustomDocument2022.htm"&gt;Session&lt;/a&gt; and the benefit it gives us developers is that we no longer have to keep track of all the changes to our persistent classes ourselves. When we used the Session object each instance of our business objects had to be sent the Save() message in order to be persisted. When using UnitOfWork this is no longer the case, the UnitOfWork tracks all the changes for you and they are persisted by making one call to CommitChanges() once you have made all the required changes to all of your objects and you are ready to serialise your object graph.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The last thing to mention is that the default persistence mechanism is to serialise the object graph to an Access database. We shall examine how to change this default behaviour in a future recipe.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:0d341438-0ef5-44a5-b68b-3e71698f1cad" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO+Cookbook" rel="tag"&gt;XPO Cookbook&lt;/a&gt;, &lt;a href="http://technorati.com/tags/XPO" rel="tag"&gt;XPO&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f25%2fxpo-cookbook-1-quickly-serialise-an-object.aspx&amp;amp;title=XPO+Cookbook+%231+%e2%80%93+Quickly+Serialise+an+Object"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=232257" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO/default.aspx">XPO</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO+Cookbook/default.aspx">XPO Cookbook</category></item><item><title>Cooking up a Storm with XPO and XAF</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/25/cooking-up-a-storm-with-xpo-and-xaf.aspx</link><pubDate>Mon, 25 Aug 2008 10:08:01 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:232246</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=232246</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/25/cooking-up-a-storm-with-xpo-and-xaf.aspx#comments</comments><description>&lt;p&gt;My wife likes to cook – which is good for me, as I like to eat – and every time I watch her in the kitchen I can’t help but notice the parallels between chefs and programmers.&lt;/p&gt;  &lt;p&gt;There are chefs who work for large hotels and conference centres who prepare large banquets for guests and attendees, as well as numerous lunches and snacks throughout the day. This is analogous to the enterprise programmer who works on enterprise scale systems such as accounting and CRM, but who also finds himself having to patch together a myriad of scripts to fulfill the extraneous requirements of of those further up the enterprise food chain. There are also chefs who work in smaller hotels and cafes, providing meals on a, some what, ad hoc basis to passing customers, these chefs are analogous to the smaller coding shops who tend to work on a customer by customer basis. Each, in their own way, striving to find the best ingredients to put together to make a superb dish to delight their customers.&lt;/p&gt;  &lt;p&gt;When it comes to ingredients I am fortunate enough to live in an area that constitutes some of &lt;a href="http://www.prnewswire.co.uk/cgi/news/release?id=23688"&gt;the best agricultural land in Scotland&lt;/a&gt;; in fact the &lt;a href="http://en.wikipedia.org/wiki/Carse_of_Gowrie"&gt;Carse of Gowrie&lt;/a&gt; is famed the world over for the quality of it’s soft fruit (that’s raspberries and the like to you and me). It’s the same when we speak of “ingredients” for applications too, I’m lucky enough to work for a company who provide programmers with some of &lt;a href="http://www.devexpress.com/Products/NET/DXperience/"&gt;the best “ingredients” available&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Another parallel I see between chefs and programmers is in books. My wife loves cookbooks, almost as much as I love technical books. Chefs have books that explain &lt;a href="http://www.amazon.co.uk/Household-Management-Southover-Historic-Housekeeping/dp/187096215X/ref=pd_sim_b_3"&gt;everything it takes to run a kitchen&lt;/a&gt;, as we have books that &lt;a href="http://www.amazon.co.uk/Enterprise-Application-Architecture-Addison-Wesley-Signature/dp/0321127420/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1219658527&amp;amp;sr=1-1"&gt;explain enterprise architecture&lt;/a&gt;. Chefs have speciality books that concentrate on &lt;a href="http://www.amazon.co.uk/Souffle-Sweet-Savoury-Hamlyn-Reference/dp/0600613429/ref=sr_1_3?ie=UTF8&amp;amp;s=books&amp;amp;qid=1219658582&amp;amp;sr=1-3"&gt;one small facet of cooking&lt;/a&gt; and &lt;a href="http://www.amazon.co.uk/Pro-LINQ-Language-Integrated-Query/dp/1590597893/ref=sr_1_2?ie=UTF8&amp;amp;s=books&amp;amp;qid=1219658639&amp;amp;sr=1-2"&gt;we have similar books&lt;/a&gt; in our world. So it is with this in mind that I decided to start two little “books” of my own; the XAF Cookbook and the XPO Cookbook, look out for them in future posts. I hope you enjoy them and that they help you cook up some “tasty dishes” of your own.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:da7d1998-74b0-42f7-b5f5-614c6a2da33c" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XAF+Cookbook" rel="tag"&gt;XAF Cookbook&lt;/a&gt;, &lt;a href="http://technorati.com/tags/XPO+Cookbook" rel="tag"&gt;XPO Cookbook&lt;/a&gt;, &lt;a href="http://technorati.com/tags/DevExpress" rel="tag"&gt;DevExpress&lt;/a&gt;, &lt;a href="http://technorati.com/tags/DXperience" rel="tag"&gt;DXperience&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f25%2fcooking-up-a-storm-with-xpo-and-xaf.aspx&amp;amp;title=Cooking+up+a+Storm+with+XPO+and+XAF"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=232246" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO/default.aspx">XPO</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category></item><item><title>XPOlympics – Serialising RSS Feeds Using XPO</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/20/xpolympics-serialising-rss-feeds-using-xpo.aspx</link><pubDate>Wed, 20 Aug 2008 12:19:31 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:231767</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=231767</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/20/xpolympics-serialising-rss-feeds-using-xpo.aspx#comments</comments><description>&lt;p&gt;Although the UK is a crowded island sitting on the border of the Atlantic Ocean and the North Sea, comfortably far from mainland Europe, its population is relatively small; in fact when compared to the those of China or India it is, in fact, tiny (estimated to be 60.7 million as of July 2007). Perhaps it is this fact that means I am always surprised when the UK does well at global scale sporting events such as the Olympics, and there is no doubt that Team GB (more correctly Great Britain and Northern Ireland) has excelled at these games, putting in the best performance, in terms of medal haul, since the 1908 games.&lt;/p&gt;  &lt;p&gt;So what has all this to do with XPO? Well I like to keep up with what is going on at the Olympics but that “work thing” just keeps getting in the way. Coupled with that I’d really like to record all the news so that I can go back and analyse&amp;#160; it after the event. So, what I really need is a little application to handle the following requirements:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Read an XML file and fetch one or more RSS feed URLs&lt;/li&gt;    &lt;li&gt;For each feed&lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;Check if that feed has been serialised previously&lt;/li&gt;      &lt;ol&gt;       &lt;li&gt;If it hasn’t&lt;/li&gt;        &lt;ol&gt;         &lt;li&gt;Create it&lt;/li&gt;       &lt;/ol&gt;        &lt;li&gt;If it has then fetch the matching feed object from the database&lt;/li&gt;     &lt;/ol&gt;      &lt;li&gt;Send a HEAD request to the web server for the RSS feed file header information&lt;/li&gt;      &lt;ol&gt;       &lt;li&gt;Examine the last-modified header&lt;/li&gt;        &lt;ol&gt;         &lt;li&gt;If there is no last-modified header then skip this file&lt;/li&gt;          &lt;li&gt;If the file has not been updated since last read then skip the file&lt;/li&gt;       &lt;/ol&gt;     &lt;/ol&gt;      &lt;li&gt;Fetch all the news items from the RSS feed&lt;/li&gt;      &lt;ol&gt;       &lt;li&gt;For each news item&lt;/li&gt;        &lt;ol&gt;         &lt;li&gt;Create a news item object&lt;/li&gt;          &lt;li&gt;Check if the fetched / created feed object has this news item already&lt;/li&gt;          &lt;ol&gt;           &lt;li&gt;If it does then skip this news item&lt;/li&gt;            &lt;li&gt;Otherwise add the news item to the feed&lt;/li&gt;         &lt;/ol&gt;       &lt;/ol&gt;     &lt;/ol&gt;      &lt;li&gt;Set the lastUpdate date to now.&lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;Serialise the newly created object graph to the database&lt;/li&gt;    &lt;li&gt;This process must be able to be automated using the Windows AT command&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Looking at the requirements, it’s clear to see that, apart from doing a few sensible checks, all that is required is that an RSS feed is serialised to a database, that sounds to me like a perfect job for XPO. Now, a blog posting is not a suitable place to examine such an application line by line (I leave that as an exercise for the reader) but let’s look at some of the more pertinent points of the application.&lt;/p&gt;  &lt;p&gt;Firstly I could have used an &lt;a href="http://en.wikipedia.org/wiki/OPML"&gt;OPML file&lt;/a&gt; to contain my list of RSS feed URLs that is, after all, what it was designed for. However, I felt that was a little overkill for the purposes of our application and so I went with a more simplified “roll you own” file structure as shown below.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a31515;"&gt;xml &lt;/span&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;1.0&lt;/span&gt;&amp;quot; &lt;span style="color:red;"&gt;encoding&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;utf-8&lt;/span&gt;&amp;quot; &lt;span style="color:blue;"&gt;?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Feeds&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Feed&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Feed Name&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Url&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;Feed URL&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Url&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Feed&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Feeds&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Having specified which feeds we wish to read (my application reads the 32 BBC feeds dedicated to the Olympics) we should now go ahead and specify our Feed and NewsItem domain objects. I’m not going to cover that here as it is &lt;a href="http://www.devexpress.com/Help/?document=XPO/CustomDocument2256.htm&amp;amp;levelup=true"&gt;clearly documented&lt;/a&gt; on our web site.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The first thing I’d like to draw your attention to is the fact that, by default, XPO will serialise objects to an Access database, if you want to use another database (and we support over 15 RDBMSs) then you have to inform XPO like so:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;SetUpXPODataLayer() {
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;conn =
        &lt;span style="color:#2b91af;"&gt;MSSqlConnectionProvider&lt;/span&gt;.GetConnectionString(&lt;span style="color:#a31515;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;,
            &lt;span style="color:#a31515;"&gt;&amp;quot;XPOlympics&amp;quot;&lt;/span&gt;);

    &lt;span style="color:#2b91af;"&gt;XpoDefault&lt;/span&gt;.DataLayer =
        &lt;span style="color:#2b91af;"&gt;XpoDefault&lt;/span&gt;.GetDataLayer(conn,
            &lt;span style="color:#2b91af;"&gt;AutoCreateOption&lt;/span&gt;.DatabaseAndSchema);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The next thing I want to draw your attention to is not specifically XPO related but is, never the less, interesting. It is the technique of only fetching the header information from the web server to ascertain whether or not a file has been updated, this prevents you having to download the entire file unnecessarily and is done like this:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;//GS - Make a request for the feed header info only and 
//get the last-modified date
&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;HttpWebRequest &lt;/span&gt;webRequest =
    &lt;span style="color:#2b91af;"&gt;HttpWebRequest&lt;/span&gt;.Create(feed.Url) &lt;span style="color:blue;"&gt;as &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;HttpWebRequest&lt;/span&gt;;
webRequest.Method = &lt;span style="color:#a31515;"&gt;&amp;quot;HEAD&amp;quot;&lt;/span&gt;;
webRequest.KeepAlive = &lt;span style="color:blue;"&gt;false&lt;/span&gt;;

&lt;span style="color:#2b91af;"&gt;WebResponse &lt;/span&gt;webResponse = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;
&lt;span style="color:blue;"&gt;string &lt;/span&gt;lastModifiedDateString = &lt;span style="color:#2b91af;"&gt;String&lt;/span&gt;.Empty;
&lt;span style="color:blue;"&gt;try &lt;/span&gt;{
    webResponse = webRequest.GetResponse();
    lastModifiedDateString =
    webResponse.Headers.Get(&lt;span style="color:#a31515;"&gt;&amp;quot;Last-Modified&amp;quot;&lt;/span&gt;);
}
&lt;span style="color:blue;"&gt;catch &lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;WebException &lt;/span&gt;wex) {
    &lt;span style="color:#2b91af;"&gt;Trace&lt;/span&gt;.WriteLine(&lt;span style="color:#2b91af;"&gt;String&lt;/span&gt;.Format(&lt;span style="color:#a31515;"&gt;&amp;quot;{0} - {1} {2}&amp;quot;&lt;/span&gt;,
        &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt;.Now, wex.Message, feed.Name));
    &lt;span style="color:#2b91af;"&gt;Trace&lt;/span&gt;.Flush();
    &lt;span style="color:#2b91af;"&gt;Trace&lt;/span&gt;.Close();
    &lt;span style="color:blue;"&gt;continue&lt;/span&gt;;
}
&lt;span style="color:blue;"&gt;finally &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(webResponse != &lt;span style="color:blue;"&gt;null&lt;/span&gt;) {
        webResponse.Close();
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Note the use of the “KeepAlive = false;” line above, this prevents the HttpWebRequest object from keeping the connection open and causing “connection leaks”. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Whilst I’m on the subject of things which are not specifically XPO related but are interesting anyway, note the use of LINQ to XML to extract the news items from the feed, isn’t that syntax so much nicer that the XPath way of doing things?&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;var &lt;/span&gt;newsItems =
    &lt;span style="color:blue;"&gt;from &lt;/span&gt;item &lt;span style="color:blue;"&gt;in &lt;/span&gt;feedDoc.Descendants(&lt;span style="color:#a31515;"&gt;&amp;quot;item&amp;quot;&lt;/span&gt;)
    &lt;span style="color:blue;"&gt;select new &lt;/span&gt;{
        Title = item.Element(&lt;span style="color:#a31515;"&gt;&amp;quot;title&amp;quot;&lt;/span&gt;).Value,
        Description = item.Element(&lt;span style="color:#a31515;"&gt;&amp;quot;description&amp;quot;&lt;/span&gt;).Value,
        PubDate = item.Element(&lt;span style="color:#a31515;"&gt;&amp;quot;pubDate&amp;quot;&lt;/span&gt;).Value,
        Category = item.Element(&lt;span style="color:#a31515;"&gt;&amp;quot;category&amp;quot;&lt;/span&gt;).Value,
        Url = item.Element(&lt;span style="color:#a31515;"&gt;&amp;quot;link&amp;quot;&lt;/span&gt;).Value
    };&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Anyway, this is an XPO blog so let’s get back on topic shall we? Having fetched or created a new feed and extracted the news items from the RSS document we want to add the news item to the feed, but only if it hasn’t been added before, we don’t want duplicate news items in our feed. We can use XPO to check it’s not been added already this way:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(!aFeed.NewsItems.Contains&amp;lt;&lt;span style="color:#2b91af;"&gt;NewsItem&lt;/span&gt;&amp;gt;(aNewsItem)) {
    aFeed.NewsItems.Add(aNewsItem);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Now, all that remains for us to do is to serialise our newly created object graph to the database by calling &lt;a href="http://www.devexpress.com/Help/?document=xpo/devexpressxpounitofwork_commitchangestopic.htm"&gt;CommitChanges()&lt;/a&gt; on the &lt;a href="http://www.devexpress.com/Help/?document=xpo/customdocument2138.htm"&gt;UnitOfWork&lt;/a&gt; object.&lt;/p&gt;

&lt;p&gt;If you would like to download the full application and have a look at it, you can get it &lt;a href="http://community.devexpress.com/blogs/garyshort/XPOlympics.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2ba74c1a-13a7-4cb0-85e7-5c39a3b88310" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO" rel="tag"&gt;XPO&lt;/a&gt;, &lt;a href="http://technorati.com/tags/RSS" rel="tag"&gt;RSS&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Olympics" rel="tag"&gt;Olympics&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f20%2fxpolympics-serialising-rss-feeds-using-xpo.aspx&amp;amp;title=XPOlympics+%e2%80%93+Serialising+RSS+Feeds+Using+XPO"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=231767" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO/default.aspx">XPO</category></item><item><title>The eXpressApp Application Framework, Project Mojave and Show-stoppers</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/06/the-expressapp-application-framework-project-mojave-and-show-stoppers.aspx</link><pubDate>Wed, 06 Aug 2008 12:01:31 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:230120</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>26</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=230120</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/06/the-expressapp-application-framework-project-mojave-and-show-stoppers.aspx#comments</comments><description>&lt;p&gt;The provenance of the word show-stopper dates back to the music hall days when a performer’s act was so good that the show was quite literally brought to a stop by the audience’s applause. Of course, time moves on and the word has taken on an altogether more sinister meaning, with it now conjuring up the idea of a fault so catastrophic as to bring the use of something, or the sale of something, to a premature end. A good example of this is the Millennium Bridge, the most recent bridge to be built across the Thames in London.&lt;/p&gt;  &lt;p&gt;The Millennium Bridge is a foot bridge crossing the Thames at St. Paul’s. It opened on June 10 2000. Now every structure has a resonance frequency, a frequency at which it will oscillate at maximum amplitude. Unfortunately for the Millennium Bridge, it’s resonance frequency was close to the natural footfall of the average person, not good on a foot bridge! The result was that when people walked on it, it swayed, as it swayed people naturally fell instep with the swaying motion, which amplified the swaying motion and so and and so forth in a feedback loop. Before long the bridge was swaying wildly and it was finally closed to the public on June 12 2000 to enable remedial engineering work to be carried out. A true show-stopper in the modern sense of the word.&lt;/p&gt;  &lt;p&gt;Of course we are more familiar with the term show-stopper to mean a fault, or a series of faults, that render a software product unusable. The most stark example of this at the moment is probably Microsoft’s Vista operating system. When Vista shipped it received some bad press and in this age of the blogsphere echo chamber that negative press was passed on and amplified, to the point now where users who have never seen, let alone installed, Vista think it is a terrible product and will quite happily tell anyone who will listen all about it’s failings and short comings. This negative impression of Vista could become, not so much a show-stopper, but something which could seriously retard the sales of Vista.&lt;/p&gt;  &lt;p&gt;It’s hard to get out from underneath the snowball of such negativity, fueled as it is by the echoing nature of the blogsphere, but Microsoft have attempted to do just that with &lt;a href="http://www.mojaveexperiment.com/"&gt;Project Mojave&lt;/a&gt;. In this experiment a number of people, who had a pre-existing negative view of Vista, were shown a “new” operating system called Mojave. They all thought the new operating system was amazing and wanted to know when they could upgrade to it; only then were they told that they had, in fact, just been shown Vista. Whether initiatives like this are enough to combat the negativity surrounding Vista remain to be seen, but it is certainly a good start.&lt;/p&gt;  &lt;p&gt;To a certain extent we suffer a similar problem with &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt;, not around the quality of the product, everyone I show it to loves it, but there is a perception that XAF has a steep learning curve, and that learning curve is putting people off taking up the framework. Well guess what, those people are not wrong, they are just not completely right. Now XAF has a learning curve, there is no doubt about that, however it is worth noting that every framework, which increases developer productivity, is going to have a learning curve and the more a framework does for you, the more productive you are, the more there is going to be to learn. &lt;/p&gt;  &lt;p&gt;So, now that we have established that there is no getting away from the learning curves associate with an application framework, what are DevExpress doing to help? Well we are tackling the problem on a number of fronts. Firstly, there is the &lt;a href="http://www.devexpress.com/Help/?document=ExpressApp"&gt;documentation&lt;/a&gt;, then there are the &lt;a href="http://tv.devexpress.com/XAF.tags"&gt;videos&lt;/a&gt; and lastly, but I hope not least, there are evangelists like me. If you have an issue regarding not being able to work out how the framework works in a particular area, then please feel free to get in touch with me at garysATdevexpressDOTcom. Trust me, the view from the top is worth the effort. :-)&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ed79db21-d082-4a19-9141-2c449bf3e07f" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XAF" rel="tag"&gt;XAF&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Application+Frameworks" rel="tag"&gt;Application Frameworks&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f06%2fthe-expressapp-application-framework-project-mojave-and-show-stoppers.aspx&amp;amp;title=The+eXpressApp+Application+Framework%2c+Project+Mojave+and+Show-stoppers"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=230120" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Videos/default.aspx">Videos</category></item><item><title>XPO Will Benefit from the Entity Framework</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/08/01/xpo-will-benefit-from-the-entity-framework.aspx</link><pubDate>Fri, 01 Aug 2008 10:28:10 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:229580</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>25</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=229580</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/08/01/xpo-will-benefit-from-the-entity-framework.aspx#comments</comments><description>&lt;p&gt;Yesterday, as I was pondering the internals of the &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; model for my ongoing &lt;a href="http://community.devexpress.com/blogs/garyshort/archive/2008/07/22/you-say-potato-i-say-potahto-localization-in-the-express-application-framework.aspx"&gt;localization project&lt;/a&gt;, I received an email from the Microsoft Community Leaders mailing list informing me that the Entity Framework will ship as part of Visual Studio 2008 SP1 later this year. Now - as you ponder which is the more disturbing part of that sentence, the fact that I’m a community leader in Scotland or the fact that the Entity Framework is soon to be released into the wild – let me tell you that, around the same time as I received that email, I was listening to a podcast where a group of well known developers were discussing the Entity Framework.&lt;/p&gt;  &lt;p&gt;Whilst discussing it’s short comings, those developers were traveling a well worn path. Those of us with an interest in the ORM tool space (and hopefully that is everyone reading this blog) are well aware of the areas in which this first release version of the Entity Framework will fall short, namely:&amp;#160; focusing on the data aspects of the entity at the expense of the behavioral aspects; the excess code developers will have to write in order to cope with the poor decisions taken by the team around the lazy loading of associated entities; the Entity Framework’s view of a shared model which flies in the face of best practice and other such failings that we need not dredge up here.&lt;/p&gt;  &lt;p&gt;However, the most interesting point made in the podcast and the one I am echoing here in this blog post, was that the release of the Entity Framework this summer is to be broadly welcomed amongst vendors and consumers of ORM tools. Why is that you ask, when the framework falls so obviously short of the required mark? Well it is a sad fact of life that many companies and many individual developers too for that matter, will not contemplate looking at a new architectural paradigm until such time as it appears on the Microsoft development stack. Whist there are those of us who are happy to inhabit the world of XPO, NHibernate and other ORM tools, it remains a sad fact that we, ladies and gentlemen, are very much in the minority.&lt;/p&gt;  &lt;p&gt;With the release of Visual Studio 2008 SP1 this summer, that is all about to change, an ORM tool (albeit a flawed one) will then become a first class citizen in the Microsoft development stack. That fact will open up the world of ORM to many more people, and as those people explore that new world many will drift to XPO and other ORM tools, making 2009, in my opinion, a great year to be in the ORM space. We think XPO is a great ORM tool and we look forward to welcoming all the new users that the Entity Framework will introduce us to.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4004016e-6ea1-410c-9d1d-f94422192eed" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XPO" rel="tag"&gt;XPO&lt;/a&gt;, &lt;a href="http://technorati.com/tags/ORM" rel="tag"&gt;ORM&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Object%2fRelational+Mapping" rel="tag"&gt;Object/Relational Mapping&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Entity+Framework" rel="tag"&gt;Entity Framework&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Visual+Studio+2008+SP1" rel="tag"&gt;Visual Studio 2008 SP1&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f08%2f01%2fxpo-will-benefit-from-the-entity-framework.aspx&amp;amp;title=XPO+Will+Benefit+from+the+Entity+Framework"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=229580" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XPO/default.aspx">XPO</category></item><item><title>You say Potato I say Potahto: Localization in the eXpress Application Framework</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/07/22/you-say-potato-i-say-potahto-localization-in-the-express-application-framework.aspx</link><pubDate>Tue, 22 Jul 2008 14:11:34 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:228125</guid><dc:creator>Gary Short (Developer Express)</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=228125</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/07/22/you-say-potato-i-say-potahto-localization-in-the-express-application-framework.aspx#comments</comments><description>&lt;p&gt;On a recent &lt;a href="http://community.devexpress.com/blogs/garyshort/archive/tags/Videos/default.aspx"&gt;film making trip to LA&lt;/a&gt;, we were out for dinner one night when the waiter asked me what kind of salad I would like, I replied that I would like tomato. Ray, good humoredly, corrected me and said it was tomayto not tomato. Of course he is right, not because he is an expert in the Americanization of the English language, but because he pays my salary and that trump card is enough to hold sway in most arguments. However, it did reminded me of Churchill’s old adage that the U.K. and the U.S. are two countries separated by a common language.&lt;/p&gt;  &lt;p&gt;However much that may or may not be true, it is a fact that in our industry, language can be a separator separating countries (and therefore people) into the haves and the have nots depending on whether a particular piece of software has been localized for their country or not. To solve this problem an industry has grown up around &lt;a href="http://en.wikipedia.org/wiki/Internationalization"&gt;internationalization and localization&lt;/a&gt;, with &lt;a href="http://www.amazon.co.uk/s/ref=nb_ss_b/026-6245528-4066030?url=search-alias%3Dstripbooks&amp;amp;field-keywords=Internationalization"&gt;books&lt;/a&gt; on the subject and &lt;a href="http://www.google.co.uk/search?hl=en&amp;amp;q=localization+tools&amp;amp;meta="&gt;tools&lt;/a&gt; to help the developer with the process; there are also a number of &lt;a href="http://www.lisa.org/Standards.30.0.html"&gt;industry standards&lt;/a&gt; to aid collaboration.&lt;/p&gt;  &lt;p&gt;When it comes to the localization of software, and that is the only kind of localization we are dealing with in this post, there is a fairly straight forward workflow to follow:-&lt;/p&gt;  &lt;p&gt;&lt;img title="Workflow" style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="1096" alt="Workflow" src="http://community.devexpress.com/blogs/garyshort/WindowsLiveWriter/YousayPotatoIsayPotahtoLocalisationinthe_A5A5/Workflow_5.png" width="126" align="left" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;So does &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; support this localization workflow? Well the answer is yes but not entirely. It is clear that applications created with &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; are internationalized, that is to say, the up front work of designing and creating an application to be localizable, has been done for you. It is also clear that the step of extracting localizable content into a central data store has been facilitated through the use of the Model and because the Model Editor can be used as a stand alone product, a developer could use that mechanism in order to allow a translation agent to work with the localizable content. So, to quite a considerable degree, this workflow is supported within &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;However, &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; is not perfect (what software product is?) and it is clear that the area in which it lacks, is in its ability to export the localizable content, in a standards compliant medium, for onward transmission to a translation agent; nor does &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; have a mechanism by which to import the translated content back into the Model. Now we do plan to fully support this workflow at some point in the future, it’s just that the opportunity to include it has not presented itself yet.&lt;/p&gt;  &lt;p&gt;Although I believe this to be a minor deficit in the productivity gains that &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; brings to the developer, I feel the time has come to rectify this deficit; so, in the coming days I am going to design, build, test and publish a tool that will allow the export and import of localizable content. This will allow &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; to fully support this localization workflow. I will be blogging my progress in future posts, so those of you who have an interest in this topic can follow along at home.&lt;/p&gt;  &lt;p&gt;In the meantime, you can read more about &lt;a href="http://www.devexpress.com/xaf"&gt;XAF’s&lt;/a&gt; support for localization in our &lt;a href="http://www.devexpress.com/Help/?document=expressapp/customdocument2595.htm"&gt;documentation&lt;/a&gt;.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b1a56f23-6874-43c4-9373-78113bcb36da" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/XAF" rel="tag"&gt;XAF&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Localization" rel="tag"&gt;Localization&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Custom+Tools" rel="tag"&gt;Custom Tools&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Application+Model" rel="tag"&gt;Application Model&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fcommunity.devexpress.com%2fblogs%2fgaryshort%2farchive%2f2008%2f07%2f22%2fyou-say-potato-i-say-potahto-localization-in-the-express-application-framework.aspx&amp;amp;title=You+say+Potato+I+say+Potahto%3a+Localization+in+the+eXpress+Application+Framework"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=228125" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category></item><item><title>New video: Too little pink in your business applications? Customize them with the eXpressApp Framework!</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/07/14/new-video-too-little-pink-in-your-business-applications-customize-them-with-the-expressapp-framework.aspx</link><pubDate>Mon, 14 Jul 2008 15:51:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:227051</guid><dc:creator>Oliver Sturm (Developer Express)</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=227051</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/07/14/new-video-too-little-pink-in-your-business-applications-customize-them-with-the-expressapp-framework.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://tv.devexpress.com/content/xaf/xafcustomization2/"&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/xafcustomization.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This final video in the series of &amp;quot;things we did in LA&amp;quot; demonstrates various levels on which you can customize your XAF applications and thereby make them much pinker. Or of course you could choose to make them prettier, but we&amp;#39;re no good at that, so we decided to go for pinker. Well, not only that - have a look and see for yourself. Including a cameo appearance by a DevExpress employee code named &amp;quot;The Marble&amp;quot;. Watch out for him (hint: he&amp;#39;s the one with the weird accent!)&lt;/p&gt;
&lt;p&gt;Click the image or &lt;a href="http://tv.devexpress.com/content/xaf/xafcustomization2/"&gt;this link&lt;/a&gt; to watch the video!&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=227051" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/skins/default.aspx">skins</category></item><item><title>New video: Custom Validation with the XAF Business Application Framework</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/07/14/new-video-custom-validation-with-the-xaf-business-application-framework.aspx</link><pubDate>Mon, 14 Jul 2008 15:34:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:227045</guid><dc:creator>Oliver Sturm (Developer Express)</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=227045</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/07/14/new-video-custom-validation-with-the-xaf-business-application-framework.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://tv.devexpress.com/content/xaf/xafcustom%20validation/"&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/xafcustomvalidation.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This video is about implementing a custom validation provider for XAF, or if you believe Gary (this is still Oliver writing here), it&amp;#39;s about GIGO - Garbage In, Garbage Out. In any case, XAF provides the means to keep users from entering more garbage than is good for them, and in many cases this means extending the validation system to support checking for conditions that depend on your business logic.&lt;/p&gt;
&lt;p&gt;It should be said that this video was created on the basis of XAF 8.1, and there are some changes in the validation code for 8.2, so if you&amp;#39;re trying to copy the sample code from screen, your mileage will vary. I&amp;#39;ll create an updated sample for 8.2 and post it later - my apologies for this inconvenience. Anyway, the information is the same and it&amp;#39;s still fun to watch!&lt;/p&gt;
&lt;p&gt;Click the image or &lt;a href="http://tv.devexpress.com/content/xaf/xafcustom%20validation/"&gt;this link&lt;/a&gt; to watch the video!&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=227045" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category></item><item><title>New video: Data Analysis with the XtraPivotGrid and XtraCharts in XAF 8.2</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/07/11/new-video-data-analysis-with-the-xtrapivotgrid-and-xtracharts-in-xaf-8-2.aspx</link><pubDate>Fri, 11 Jul 2008 09:35:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:226725</guid><dc:creator>Oliver Sturm (Developer Express)</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=226725</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/07/11/new-video-data-analysis-with-the-xtrapivotgrid-and-xtracharts-in-xaf-8-2.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://tv.devexpress.com/Content/XAF/XAFPivotChart/"&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/xafpivotchart.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Another great new XAF feature in 8.2 is the &amp;quot;PivotChart&amp;quot; module. It combines the functionality of our XtraPivotGrid and the XtraCharts to allow the end user to create data analysis views in the format of an interactive Pivot table and/or a chart. If you haven&amp;#39;t installed the 8.2 RC yet, be sure to have a look at this to see what&amp;#39;s in store for you!&lt;/p&gt;
&lt;p&gt;Click the image or &lt;a href="http://tv.devexpress.com/Content/XAF/XAFPivotChart/"&gt;this link&lt;/a&gt; to watch the video!&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=226725" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XtraCharts/default.aspx">XtraCharts</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XtraPivotGrid/default.aspx">XtraPivotGrid</category></item><item><title>New video: Ribbon support in XAF 8.2</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/07/10/new-video-ribbon-support-in-xaf-8-2.aspx</link><pubDate>Thu, 10 Jul 2008 14:31:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:226565</guid><dc:creator>Oliver Sturm (Developer Express)</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=226565</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/07/10/new-video-ribbon-support-in-xaf-8-2.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://tv.devexpress.com/content/XAF/XAFribbons"&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/xafribbons.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here we go, a video about one of the new features in XAF 8.2: support for Ribbon style toolbars in the Windows Forms application. It was recorded with a development build, so you will see a few rough edges, but it offers a nice preview especially for those of you who haven&amp;#39;t taken the time to download and install 8.2 RC so far. Click the image or &lt;a href="http://tv.devexpress.com/content/XAF/XAFribbons"&gt;this link&lt;/a&gt; to watch the video!&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=226565" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Ribbon/default.aspx">Ribbon</category></item><item><title>Models and XAF</title><link>http://community.devexpress.com/blogs/garyshort/archive/2008/07/02/models-and-xaf.aspx</link><pubDate>Wed, 02 Jul 2008 18:23:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:225339</guid><dc:creator>Oliver Sturm (Developer Express)</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=225339</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2008/07/02/models-and-xaf.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://tv.devexpress.com/content/XAF/XAFmodels"&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/xafmodels.png" style="margin:0 3px 0 0;" align="left" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is Oliver here, posting to Gary&amp;#39;s blog. I thought it would be good to keep further video announcements on this blog in case somebody is following Gary exclusively - he&amp;#39;s on vacation (well... he wasn&amp;#39;t working for DevExpress yet when he planned it &amp;lt;g&amp;gt;), so somebody has to do the announcing.&lt;/p&gt;
&lt;p&gt;So &lt;a href="http://tv.devexpress.com/content/XAF/XAFmodels"&gt;here it is&lt;/a&gt;, a video about models and XAF. Have fun!&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=225339" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Videos/default.aspx">Videos</category></item></channel></rss>