<?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>JSON Serialisation with XPO and JSON.Net</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/09/14/json-serialisation-with-xpo-and-json-net.aspx</link><pubDate>Wed, 14 Sep 2011 13:37:33 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:354150</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=354150</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/09/14/json-serialisation-with-xpo-and-json-net.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://json.org/"&gt;JSON&lt;/a&gt;, or javaScript Object Notation, is a lightweight, data interchange format, it also seems to have become the defacto standard for serialising and deserialising information when talking to web based APIs such as Twitter and Foursquare.&lt;/p&gt;  &lt;p&gt;So far so good, but here’s the thing, I DON’T CARE! When I’m using the API of a web based service I’m doing so because I’m trying to solve a business problem. In the case of Twitter, I might want to know who is talking about me and my product, and what are they saying. I may also want to save that data away in a database for future analysis. That’s the problem I want to solve, so I don’t care about JSON and don’t care about the database.&lt;/p&gt;  &lt;p&gt;Luckily DevEpress’ ethos is to remove the pain of boilerplate or plumbing code from you and so we can use XPO and a third party JSON library, in this case JSON.net, to allow us to concentrate on the problem in hand. So, because as developers we’re doers and not talkers, let’s stop talking about it and have a demonstration.&lt;/p&gt;  &lt;p&gt;Let’s suppose we want to get a feel for the “word on the ground” from the current BUILD conference, Twitter is the natural place to look. There is a search API we can use so let’s try it out:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; jsonString = &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient().DownloadString(&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;             &lt;span style="color:#006080;"&gt;@&amp;quot;http://search.twitter.com/search.json?q=bldwin&amp;quot;&lt;/span&gt;);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Here we are using the Twitter API to search on the hashtag for BUILD. Putting in a breakpoint and inspecting the return shows what we get back from Twitter:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://community.devexpress.com/blogs/garyshort/image_7B2C3EB1.png" width="644" height="356" /&gt;&lt;/p&gt;

&lt;p&gt;Yeah, ewww, I don’t want to have to deal with that. Time to recruit JSON.Net. Download the binary and reference it in you project and now we can turn the JSON into object, ‘cos we love objects, right?&lt;/p&gt;

&lt;p&gt;Okay, so the first thing we have to do is to create an object for JSON.Net to deserialise this stuff into. Let’s do the simplest thing that works. Looking at the JSON above we can see that there is a wrapper object that contains the results. Let’s deal with that first. For reasons that’ll I’ll get into further on, we are going to be interested in the next_page property, so let’s build an object that can store that. Something like this…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; XPO_JSON_Blog&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ResultsWrapper&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; Next_Page { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now, we can go ahead and deserialise the JSON, to this object, using JSON.Net…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Net;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Newtonsoft.Json;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; XPO_JSON_Blog&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Program&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum13"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum14"&gt;  14:&lt;/span&gt;             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; jsonString = &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum15"&gt;  15:&lt;/span&gt;                 &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient().DownloadString(&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum16"&gt;  16:&lt;/span&gt;                     &lt;span style="color:#006080;"&gt;@&amp;quot;http://search.twitter.com/search.json?q=bldwin&amp;quot;&lt;/span&gt;);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum17"&gt;  17:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum18"&gt;  18:&lt;/span&gt;             ResultsWrapper rw = &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum19"&gt;  19:&lt;/span&gt;                 JsonConvert.DeserializeObject&amp;lt;ResultsWrapper&amp;gt;(jsonString);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum20"&gt;  20:&lt;/span&gt;         }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum21"&gt;  21:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum22"&gt;  22:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;That was pretty simple. Now if we put in a breakpoint and inspect the “rw” variable, we can see the following…&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://community.devexpress.com/blogs/garyshort/image_7F8273DE.png" width="644" height="310" /&gt;&lt;/p&gt;

&lt;p&gt;That’s better, now we are dealing with .Net objects in our .Net application, so we are happier. We can also see that we have this Next_Page property, what’s all that about? Well it turns out that Twitter isn’t going to give us all the Tweets at once, we’re going to get them in pages of 15 (by default) and we’ll also get the query string to execute to get the next page. Meh, that sounds like a faff.&lt;/p&gt;

&lt;p&gt;There are a few things we have to do here. Firstly, we need to store the Tweets, after all that is the problem we are trying to solve, and to do that, first thing we need is an object to deserialise them into. For the purposes of this post, we’ll assume we are only interested in the sender of the Tweet, the date it was sent and it’s contents. So the object will look like this…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Tweet&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; DateTime Created_At { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; From_User { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; Text { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Oh, we mustn’t forget to add the collection of Tweet objects to the wrapper object so the deserialisation will work properly…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ResultsWrapper&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; Next_Page { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Tweet[] Results { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Having done that, we need to make a few changes to our code. We need to add the “rpp=100” property to the querystring, that will tell Twitter to give us 100 Tweets at a time, instead of the default 15, that way we’ll need to make fewer calls. Then we need to separate the URL from the querystring, so that we can substitute the second and subsequent strings we’ll get from Twitter. After that we’ll need a function, which we can call recursively, to fetch the pages and some local storage for our Tweets. Phew, that’s quite a few changes, but really only a few lines of code. When we’ve done all that, our code will look like this…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Program&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; List&amp;lt;Tweet&amp;gt; Tweets = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; List&amp;lt;Tweet&amp;gt;();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url = &lt;span style="color:#006080;"&gt;@&amp;quot;http://search.twitter.com/search.json&amp;quot;&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; queryString = &lt;span style="color:#006080;"&gt;@&amp;quot;?q=bldwin&amp;amp;rpp=100&amp;quot;&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;         FetchData(url, queryString);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FetchData(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; queryString)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum13"&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; jsonString =&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum15"&gt;  15:&lt;/span&gt;             &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient().DownloadString(url + queryString);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum16"&gt;  16:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum17"&gt;  17:&lt;/span&gt;         ResultsWrapper rw =&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum18"&gt;  18:&lt;/span&gt;             JsonConvert.DeserializeObject&amp;lt;ResultsWrapper&amp;gt;(jsonString);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum19"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum20"&gt;  20:&lt;/span&gt;         Tweets.AddRange(rw.Results);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum21"&gt;  21:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum22"&gt;  22:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(rw.Next_Page))&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum23"&gt;  23:&lt;/span&gt;             FetchData(url, rw.Next_Page);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum24"&gt;  24:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum25"&gt;  25:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now, let’s see what we get if we pop in a breakpoint and inspect the “Tweets” variable…&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://community.devexpress.com/blogs/garyshort/image_0ACB881C.png" width="644" height="309" /&gt;&lt;/p&gt;

&lt;p&gt;Good! We’ve got a .Net object, with the properties we’re interested in, and we’ve abstracted away the JSON that we don’t want to deal with. Now onto the database!&lt;/p&gt;

&lt;p&gt;Just as with the JSON, we want to abstract away the database, so we don’t have to worry about it and the easiest way to do that is to use XPO. Before we can start though we need to add references to the DevExpress.Xpo and DevExpress.Data libraries.&lt;/p&gt;

&lt;p&gt;Having done that we can continue to add support for XPO to our objects. First, we’ll inherit from XpObject, and we’ll add the constructor taking a Session, or a derived class. then we’ll decorate the required properties with the size attribute, just to ensure there’s enough storage for them on the database. Here’s the Tweet class after we’ve done that…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Tweet: XPObject&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Tweet(Session session): &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;(session){}&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;         &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; DateTime Created_At { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; From_User { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;     [Size(140)]&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; Text { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And that’s all we have to do to add XPO support to our project, pretty simple eh? Sadly, we’re not done just yet though, because things are a little more complicated on the JSON.Net end. You see we have to construct our XPO derived classes using a Session but, by default, JSON.Net has no idea how to do that so we have to give it a little hint, and we do that in the shape of a CustomerCreationConverter, in fact, we need one for each of our objects. The one for the Tweet object looks like this…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; TweetConverter : CustomCreationConverter&amp;lt;Tweet&amp;gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; UnitOfWork uow;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; TweetConverter(UnitOfWork uow)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.uow = uow;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; Tweet Create(Type objectType)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Tweet(uow);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum12"&gt;  12:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum13"&gt;  13:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And of course we need one for the ResultsWrapper class too.&lt;/p&gt;

&lt;p&gt;Now all we have to do is to amend our application to use the new converters and a UnitOfWork…&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FetchData(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; queryString, UnitOfWork uow)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     UnitOfWork theUnitOfWork;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (uow == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;         theUnitOfWork = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; UnitOfWork();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;         theUnitOfWork.ConnectionString = &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;span style="color:#006080;"&gt;&amp;quot;Data Source=.;Initial Catalog=BlogPostDB;Integrated Security=SSPI;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; {theUnitOfWork = uow; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; jsonString =&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum13"&gt;  13:&lt;/span&gt;             &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient().DownloadString(url + queryString);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum14"&gt;  14:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum15"&gt;  15:&lt;/span&gt;     ResultsWrapper rw =&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum16"&gt;  16:&lt;/span&gt;         JsonConvert.DeserializeObject&amp;lt;ResultsWrapper&amp;gt;(jsonString,&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum17"&gt;  17:&lt;/span&gt;             &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; JsonConverter[]{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum18"&gt;  18:&lt;/span&gt;                 &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ResultsWrapperConverter(theUnitOfWork),&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum19"&gt;  19:&lt;/span&gt;                 &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TweetConverter(theUnitOfWork)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum20"&gt;  20:&lt;/span&gt;             });&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum21"&gt;  21:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum22"&gt;  22:&lt;/span&gt;     Tweets.AddRange(rw.Results);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum23"&gt;  23:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum24"&gt;  24:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(rw.Next_Page))&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum25"&gt;  25:&lt;/span&gt;         FetchData(url, rw.Next_Page, theUnitOfWork);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum26"&gt;  26:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum27"&gt;  27:&lt;/span&gt;     theUnitOfWork.CommitChanges();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum28"&gt;  28:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div&gt;There’s just one more thing we should do before we run our application and that is put in a little protection around the API call. We don’t really need to do much in this demonstration, we’ll just say, hey if the Twitter API returns any kind of error then we’ll just just finish there and store what we have. Something really simple like this will suffice…&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FetchData(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; url, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; queryString, UnitOfWork uow)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     UnitOfWork theUnitOfWork;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (uow == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;         theUnitOfWork = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; UnitOfWork();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;         theUnitOfWork.ConnectionString = &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;span style="color:#006080;"&gt;&amp;quot;Data Source=.;Initial Catalog=BlogPostDB;Integrated Security=SSPI;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; {theUnitOfWork = uow; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; jsonString;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum14"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum15"&gt;  15:&lt;/span&gt;         jsonString =&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum16"&gt;  16:&lt;/span&gt;             &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebClient().DownloadString(url + queryString);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum17"&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum18"&gt;  18:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (WebException we){&lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;;}&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum19"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum20"&gt;  20:&lt;/span&gt;     ResultsWrapper rw =&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum21"&gt;  21:&lt;/span&gt;         JsonConvert.DeserializeObject&amp;lt;ResultsWrapper&amp;gt;(jsonString,&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum22"&gt;  22:&lt;/span&gt;             &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; JsonConverter[]{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum23"&gt;  23:&lt;/span&gt;                 &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ResultsWrapperConverter(theUnitOfWork),&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum24"&gt;  24:&lt;/span&gt;                 &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TweetConverter(theUnitOfWork)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum25"&gt;  25:&lt;/span&gt;             });&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum26"&gt;  26:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum27"&gt;  27:&lt;/span&gt;     Tweets.AddRange(rw.Results);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum28"&gt;  28:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum29"&gt;  29:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(rw.Next_Page))&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum30"&gt;  30:&lt;/span&gt;         FetchData(url, rw.Next_Page, theUnitOfWork);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum31"&gt;  31:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum32"&gt;  32:&lt;/span&gt;     theUnitOfWork.CommitChanges();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum33"&gt;  33:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Then we can run our application and store the search results in the database…&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://community.devexpress.com/blogs/garyshort/image_114EE1DF.png" width="644" height="302" /&gt;&lt;/p&gt;

&lt;p&gt;Of course, once we have them in the database we can hook up &lt;a href="http://www.devexpress.com/Products/NET/LandingPages/Analytics.xml"&gt;DevExpress Analytics&lt;/a&gt; and create some interesting visualisations. Hmm, now there’s an idea for my next post, ‘til then, happy coding! &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_6E9A7D96.png" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &lt;a href="http://www.twitter.com/snowcode"&gt;@snowcode&lt;/a&gt; has been in touch to say instead of hand cranking your own classes you can use &lt;a href="http://json2csharp.com/"&gt;json2Csharp&lt;/a&gt;. Beware though that Json2CSharp won’t generate classes that are not in the original return from the API. For example, if your original return does not contain a Geo object then no Geo class will be generated. Subsequently, the Geo object will not then be deserialised even if future returns do contain a Geo object.&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=354150" 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/JSON/default.aspx">JSON</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Twitter/default.aspx">Twitter</category></item><item><title>XAF–Ask the Team Webinar Today!</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/05/05/xaf-ask-the-team-webinar-today.aspx</link><pubDate>Thu, 05 May 2011 10:34:51 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:343639</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=343639</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/05/05/xaf-ask-the-team-webinar-today.aspx#comments</comments><description>&lt;p&gt;&lt;img style="margin:0px 5px 5px 0px;display:inline;float:left;" align="left" src="http://farm1.static.flickr.com/93/223839049_12f0df6d95.jpg" width="139" height="185" alt="" /&gt;Yes folks, it’s that time of the month again! The time where all you good XAF programmers out there can role up to our webinar and ask me and the team any question about XAF that’s on your mind. Details of this month’s webinar can be found &lt;a href="http://devexpress.com/Support/Webinars/"&gt;here&lt;/a&gt;, where you’ll get country specific details as to the timing.&lt;/p&gt;  &lt;p&gt;As an extra special treat this evening, our brand new XAF evangelist, &lt;a href="http://community.devexpress.com/members/Apostolis-Bekiaris-_2800_DevExpress_2900_.aspx"&gt;Tolis&lt;/a&gt;, will be joining us. Tolis has a wealth of real life experience using XAF, and so this is a perfect opportunity to ask him questions about using XAF in the wild, as opposed to specific feature questions. Of course, you are still welcome to ask those too!&lt;/p&gt;  &lt;p&gt;Anyway, the team and I are really looking forward to speaking to you this evening, so pop along and register now!&lt;/p&gt;  &lt;p&gt;‘til this evening then, happy XAF’ing! &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_059F6DF5.png" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=343639" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Webinar/default.aspx">Webinar</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category></item><item><title>Attending DDD Scotland 7 May 2010</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/05/05/attending-ddd-scotland-7-may-2010.aspx</link><pubDate>Thu, 05 May 2011 09:18:44 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:343629</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=343629</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/05/05/attending-ddd-scotland-7-may-2010.aspx#comments</comments><description>&lt;p&gt;&lt;img style="margin:0px 5px 5px 0px;display:inline;float:left;" alt="DDD Scotland Logo" align="left" src="http://scottishdevelopers.files.wordpress.com/2010/11/ddds-logo-banner.gif?w=170&amp;amp;h=86" /&gt;This Saturday I’m off to &lt;a href="http://www.developerdeveloperdeveloper.com/scotland2011/Default.aspx"&gt;DDD Scotland&lt;/a&gt;, one of the &lt;a href="http://www.developerdeveloperdeveloper.com/home/"&gt;DDD&lt;/a&gt; regional events, where I’ll be presenting a session on &lt;a href="http://www.developerdeveloperdeveloper.com/scotland2011/ViewSession.aspx?SessionID=705"&gt;Asymptotes and Algorithms&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://www.developerdeveloperdeveloper.com/scotland2011/Schedule.aspx"&gt;line up for this event&lt;/a&gt; is very good, with a lot of great speakers giving interesting titled talks. If you are going to be at the event, don’t forget to say ‘hi’, I don’t bite and I like to chat with as many geeks as I can – I’ll be the guy wearing the DevExpress T – Shirt.&lt;/p&gt;  &lt;p&gt;If you can’t make it to the event (it’s been fully booked for a few weeks now) but you are going to be in the area, then pop along to the Ramada Jarvis hotel at 201 Ingram Street, Glasgow, where you’ll find us all hanging out in the bar of an evening. Feel free to swing by and say ‘hello’, who knows, I may even buy you a beer.&lt;/p&gt;  &lt;p&gt;I’ll blog a full account of the conference on Sunday, ‘til then, happy coding! &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_33EA44C6.png" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=343629" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Evangelism/default.aspx">Evangelism</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Conferences/default.aspx">Conferences</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Speaking/default.aspx">Speaking</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Community/default.aspx">Community</category></item><item><title>XAF is on The Move And so am I</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/04/13/xaf-is-on-the-move-and-so-am-i.aspx</link><pubDate>Wed, 13 Apr 2011 19:44:02 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:341800</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=341800</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/04/13/xaf-is-on-the-move-and-so-am-i.aspx#comments</comments><description>&lt;p&gt;&lt;img style="margin:0px 10px 10px 0px;display:inline;float:left;" align="left" src="http://www.zionmoving.com/images/moving%20men.jpg" width="216" height="193" alt="" /&gt;But don’t worry because neither of us are going very far. Firstly, and most importantly, where is the XAF content going? Well, as you’ll know by now, we were lucky enough to hire &lt;a href="http://community.devexpress.com/blogs/tolis/default.aspx"&gt;Tolis&lt;/a&gt; as a new evangelist on the frameworks team. Obviously he’ll be blogging about XAF and, equally obviously, he won’t be publishing those posts on my blog. So we took the decision to move all XAF content (from this point forward) back to the &lt;a href="http://community.devexpress.com/blogs/eaf/default.aspx"&gt;XAF blog&lt;/a&gt;, where it used to live before I joined DevExpress. Just to be clear then, from now on, all the XAF related blog posts will be found at the following URL:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://community.devexpress.com/blogs/eaf/default.aspx"&gt;http://community.devexpress.com/blogs/eaf/default.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So that takes care of XAF, but what about me? Well, as I said, I’m not going far. I’ll be sticking around to help Tolis settle in, and also to co-host the XAF webinars with him and anything else he needs as he finds his feet with the company, with the products, and with you horrible lot. &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_02DA1E05.png" /&gt;&lt;/p&gt;  &lt;p&gt;Other than that, I’ll be taking over the role of Developer Evangelist at DevExpress. What will that mean? Well, in the main, it will mean that my duties will expand to cover all product areas within DevExpress. I’ll be getting out and about as much as possible and meeting as many of you as I can, whilst showing off whatever part of the DevExpress product line is of most interest to you. I’ll also be keeping my ear to the ground, to find out about the next hot topics, and making sure you know how to use our products with them. I’ll also be making videos and doing webinars with you as I show off what’s new and cool out there. So sit back, relax and enjoy the ride, it’s sure to be a blast.&lt;/p&gt;  &lt;p&gt;Well that’s all for this post, so until next time, happy… err… well I’m not too sure really. Dang, looks like I need a new sign off! &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_02DA1E05.png" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=341800" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Evangelism/default.aspx">Evangelism</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/XAF/default.aspx">XAF</category></item><item><title>Sql Bits 8 – ‘Beside the Seaside’</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/04/12/sql-bits-8-beside-the-seaside.aspx</link><pubDate>Tue, 12 Apr 2011 16:58:51 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:341685</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=341685</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/04/12/sql-bits-8-beside-the-seaside.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://sqlbits.com/"&gt;&lt;img style="margin:0px 10px 10px 0px;display:inline;float:left;" alt="SQLBits Logo" align="left" src="http://sqlbits.com/images/sqlbits/SQLBitsLogo.png" /&gt;&lt;/a&gt;April 7 – 9 saw us make the trip down to sunny Brighton for SQL Bits, Europe’s largest SQL Server conference. The weather was amazing and the glorious sunshine added to the holiday atmosphere at the conference (the odd ice-cream on the beach didn’t hurt either &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_045A1D12.png" /&gt;).&lt;/p&gt;  &lt;p&gt;Of course we weren’t there to have fun, but to work (honest gov’), and I delivered a session on &lt;a href="http://sqlbits.com/(X(1)S(xkq3bqj54ulh1rmknteodx3p))/Sessions/Event8/Ensuring_your_Developers_don_t_Shoot_Themselves_in_the_Foot_with_Their_ORM_Tool"&gt;ways to mitigate against the the ORM / Relational impedance&lt;/a&gt;. I’ll turn this into a blog post in the next couple of days so you can all enjoy part of the conference – if not the glorious weather. Being the conference it is, SQL Bits attracts the best speakers in the SQL field from all over the world, including the &lt;a href="http://sqlcat.com/"&gt;SQL Customer Advisory Team&lt;/a&gt;, who did a keynote session and a panel discussion session. Both of these sessions were highly informative and greatly appreciated by the audience. Other speakers attended from countries as far afield as the US, Australia, Holland and Israel.&lt;/p&gt;  &lt;p&gt;&lt;img style="margin:0px 0px 10px 10px;display:inline;float:right;" align="right" src="http://a4.sphotos.ak.fbcdn.net/hphotos-ak-snc6/217610_146370695428423_100001664791901_281448_3475660_n.jpg" width="240" height="160" alt="" /&gt;Like all conferences, SQL Bits isn’t all about the sessions, but is an opportunity to catch up with old friends and to have a bit of fun. In my case I ran into Phil Winstanley who’ve I not spoken to since he joined Microsoft. Other attendees were able to relax and play around on the Xbox that Microsoft were kind enough to bring down to the event.&lt;/p&gt;  &lt;p&gt;Between the great content and the great atmosphere, Sql Bits is one of the “must go to” conferences in the UK, so make sure I see you there next time, and if I do, don’t forget to say ‘hi’! &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_045A1D12.png" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=341685" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Databases/default.aspx">Databases</category></item><item><title>XAF–Domain Components How-to Implement an Address in a Business Entity</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/03/28/xaf-domain-components-how-to-implement-an-address-in-a-business-entity.aspx</link><pubDate>Mon, 28 Mar 2011 15:57:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:340409</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=340409</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/03/28/xaf-domain-components-how-to-implement-an-address-in-a-business-entity.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-weight:bold;"&gt;This post may be outdated. For the latest Domain Components concepts and examples refer to the current &lt;a href="http://help.devexpress.com/#Xaf/CustomDocument3261" target="_blank"&gt;online documentation&lt;/a&gt;.&lt;/span&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Addresses are funny things aren’t they? If you own the the Address class, and you are writing it for your own application then they are easy things to handle. Each address object is a composition of a number of string types containing the information you require for your application. Simple and straight forward. Of course, as soon as you try to write a reusable interface library, things start to get a little more complicated, so let’s take a look at how we did it.&lt;/p&gt;
&lt;p&gt;First, let’s start with&amp;nbsp; an IBaseAddress component:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IBaseAddress
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;DisplayName { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
}&lt;/pre&gt;
&lt;p&gt;Having this base class for addresses we can now go on to define an IAddressable interface, which entities that require to have one, or more, addresses can use – things like Contacts, Orders, Shipping Notes etc. We can define our IAddressable interface like so:&lt;/p&gt;
&lt;pre class="code"&gt;[DomainComponent]
&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IAddressable
&lt;/span&gt;{
    [DevExpress.ExpressApp.DC.Aggregated]
    [VisibleInListView(&lt;span style="color:blue;"&gt;false&lt;/span&gt;)]
    IBaseAddress PrimaryAddress { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }

    [CreateInstance]
    IBaseAddress CreateAddress();
}&lt;/pre&gt;
&lt;p&gt;And we can use it, wherever we need to, like this:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ICRMContact &lt;/span&gt;: IContact, IAddressable, ...
&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ICRMAccount &lt;/span&gt;: IAccount, IAddressable, ...
&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;ICRMLead &lt;/span&gt;: ILead, IAddressable, ...&lt;/pre&gt;
&lt;p&gt;In this interface, there are two significant parts: the PrimaryAddress member, which is aggregated, and it brings in the minimum information of an addresses – the primary address. &lt;br /&gt;The second significant part is the CreateAddress method that is marked with the CreateInstance attribute. This method is used as a factory method to create an entity that is registered for the IBaseAddress domain component. This method is autogenerated and will work when one entity in the application implements the IBaseAddress interface. In other cases, you need to implement it manually and you’ll have to specify which entity should be created, in this method, when it is called: &lt;/p&gt;
&lt;pre class="code"&gt;[DomainLogic(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(IAddressable))] 
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;AddressableLogic &lt;/span&gt;{ 
    &lt;span style="color:blue;"&gt;public static void &lt;/span&gt;AfterConstruction(IAddressable addressable) { 
        &lt;span style="color:blue;"&gt;if&lt;/span&gt;(addressable.PrimaryAddress == &lt;span style="color:blue;"&gt;null&lt;/span&gt;) { 
            addressable.PrimaryAddress = addressable.CreateAddress(); 
        } 
}&lt;/pre&gt;
&lt;p&gt;Now our implementation is far from perfect. Using a string makes it hard to process the address by address part, to filter by a city for example. It is also impossible to guarantee any strict form of address format, which your application may need to do. Providing default lists, say of cities or of US states, is also difficult to do.&lt;/p&gt;
&lt;p&gt;So, let’s improve things by defining a generic address component in our library, this component can be substituted with your own implementation should you need something more specific.&lt;/p&gt;
&lt;p&gt;Our IGenericAddress component will look like this:&lt;/p&gt;
&lt;pre class="code"&gt;[DomainComponent]
&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;IGenericAddress &lt;/span&gt;: IBaseAddress
{
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;Street1 { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;Street2 { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;City { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;State { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;Zip { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;Country { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
}&lt;/pre&gt;
&lt;p&gt;Here you will notice that the single string DisplayName has been broken down into several string members, and is constructed from these parts when any of them is modified:&lt;/p&gt;
&lt;pre class="code"&gt;[DomainLogic(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(IGenericAddress))] 
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;GenericAddressLogic &lt;/span&gt;{ 
&lt;span style="color:blue;"&gt;private static void &lt;/span&gt;UpdateDisplayName(IGenericAddress address) { 
address.DisplayName = &lt;span style="color:blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#a31515;"&gt;&amp;quot;{0} {1} {2} {3} {4} {5}&amp;quot;&lt;/span&gt;, address.Street2, address.Street1, address.City, address.State, 
address.Zip, address.Country); 
} 
&lt;span style="color:blue;"&gt;public static void &lt;/span&gt;AfterChange_Street1(IGenericAddress address) { 
UpdateDisplayName(address); 
} 
&lt;span style="color:blue;"&gt;public static void &lt;/span&gt;AfterChange_City(IGenericAddress address) { 
UpdateDisplayName(address); 
} 
...&lt;/pre&gt;
&lt;p&gt;With this approach, it is possible for you to introduce any other Address implementation into any library component that contains the IBaseAddress member.&lt;/p&gt;
&lt;p&gt;On the Order UI in our XCRM demo application, the address UI looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/image_0F6B6B5C.png" alt="XCRM Order Address" title="XCRM Order Address" style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" border="0" height="236" width="572" /&gt;&lt;/p&gt;
&lt;p&gt;Well that’s all for this post, until next time, happy XAF’ing! &lt;img src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_6A0177ED.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=340409" 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/DC/default.aspx">DC</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Domain+Components/default.aspx">Domain Components</category></item><item><title>XAF - Domain Components How-to: Implement Notes Functionality in a Business Entity</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/03/25/xaf-domain-components-how-to-implement-notes-functionality-in-a-business-entity.aspx</link><pubDate>Fri, 25 Mar 2011 17:27:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:340231</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=340231</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/03/25/xaf-domain-components-how-to-implement-notes-functionality-in-a-business-entity.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-weight:bold;"&gt;This post may be outdated. For the latest Domain Components concepts and examples refer to the current &lt;a href="http://help.devexpress.com/#Xaf/CustomDocument3261" target="_blank"&gt;online documentation&lt;/a&gt;.&lt;/span&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Notes, every business needs them. Every person in the company who has contact with a customer has to be able to record that fact in a CRM system. The last thing you want to do is to be a salesmen phoning a customer, in the hope of getting a large order, only to discover that the last contact the customer had with your company was to complain bitterly about the shoddy service he just received. If there was a note in the system to that fact, then you could either phone once it’s been resolved, or you could change your sales tactic.&lt;/p&gt;
&lt;p&gt;Of course, saying you need notes is one thing, actually implementing it is quite another, especially if your class hierarchy already exists. You have to introduce the Note type, you have to create a member on the business objects to hold that new type, and most painful of all, you have to make room on the UI for the new note type. All and all you are in a world of pain. Now &lt;a href="http://www.devexpress.com/xaf"&gt;XAF&lt;/a&gt; can help you with the UI stuff, it will scaffold an appropriate UI for your types, but that still doesn’t save you from the pain of all the changes you have to make to your types.&lt;/p&gt;
&lt;p&gt;Well enter Domain Components to save the day! The Domain Component technology will do all that hard work for you. First, let’s declare an INote interface:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="color:#2b91af;"&gt;DomainComponent&lt;/span&gt;]
[&lt;span style="color:#2b91af;"&gt;XafDefaultProperty&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;)]
&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;INote &lt;/span&gt;{
    [&lt;span style="color:#2b91af;"&gt;RuleRequiredField&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;NoteValidationRules&lt;/span&gt;.NoteTitleIsRequired, &lt;span style="color:#2b91af;"&gt;DefaultContexts&lt;/span&gt;.Save)]
    [&lt;span style="color:#2b91af;"&gt;FieldSize&lt;/span&gt;(255)]
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;Title { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }

    [&lt;span style="color:#2b91af;"&gt;FieldSize&lt;/span&gt;(4000)]
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;Description { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
    
    &lt;span style="color:#2b91af;"&gt;IPersistentFileData &lt;/span&gt;Attachment { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; &lt;span style="color:blue;"&gt;set&lt;/span&gt;; }
}&lt;/pre&gt;
&lt;p&gt;As you can see it has a mandatory title property, so that you can name your note something meaningful, a description field, big enough to hold a reasonable sized note, and a field to hold an attachment, in case you wish to append a file to the note. Oh, and here’s the NoteValidationRules class that we’ve used in the RuleRequiredField:&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;NoteValidationRules &lt;/span&gt;{
    &lt;span style="color:blue;"&gt;public const string &lt;/span&gt;NoteTitleIsRequired = &lt;span style="color:#a31515;"&gt;&amp;quot;NoteTitleIsRequired&amp;quot;&lt;/span&gt;;
}&lt;/pre&gt;
&lt;p&gt;This pattern let’s us extend this behaviour, if we need to, at a later date.&lt;/p&gt;
&lt;p&gt;So far so good, but it’s not really useful to have one note attached to a business class, what we really need is a notes collection, so let’s go ahead and define something to hold a collection of notes:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="color:#2b91af;"&gt;DomainComponent&lt;/span&gt;]
&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;INotes &lt;/span&gt;{
    [DevExpress.ExpressApp.DC.&lt;span style="color:#2b91af;"&gt;Aggregated&lt;/span&gt;]
    &lt;span style="color:#2b91af;"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;INote&lt;/span&gt;&amp;gt; Notes { &lt;span style="color:blue;"&gt;get&lt;/span&gt;; }
}&lt;/pre&gt;
&lt;p&gt;This notes interface that we’ve just created is a pluggable part of the notes extension and now we can use it wherever we wish:&lt;/p&gt;
&lt;p&gt;public interface ICRMActivity : IActivity, INotes ... 
  &lt;br /&gt;public interface ICRMContact : IContact, INotes, ... 
  &lt;br /&gt;public interface ICRMInvoice : IInvoice, INotes, ...&lt;/p&gt;
&lt;p&gt;And so on and so forth.&lt;/p&gt;
&lt;p&gt;So, as you can see, Domain Components, have saved us an awful lot of work when it comes to adding this notes functionality. After it has been added to the Contact, the UI looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/image_40214EE1.png" alt="Notes on the Contact UI" title="Notes on the Contact UI" style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" border="0" height="543" width="694" /&gt;&lt;/p&gt;
&lt;p&gt;And it looks like this, when added to the Invoice:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://community.devexpress.com/blogs/garyshort/image_25087FD3.png" alt="Notes on the Invoice UI" title="Notes on the Invoice UI" style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" border="0" height="543" width="694" /&gt;&lt;/p&gt;
&lt;p&gt;As you can see, in this post, I have not covered testing, neither unit testing, with something like NUnit, nor functional testing with EasyTest. I didn’t add the testing stuff in as I thought it might complicate matters, but if you feel that it wouldn’t and you’d like to see testing covered in this series, then let me know in the comments and I’ll add it to the next one.&lt;/p&gt;
&lt;p&gt;Well, that’s all for this post, until next time, happy XAF’ing! &lt;img src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_514506B7.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=340231" 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/DC/default.aspx">DC</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Domain+Components/default.aspx">Domain Components</category></item><item><title>Data Layer – 11.1 Sneak Peek – Custom Functions Part 2</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/03/23/data-layer-11-1-sneak-peek-custom-functions-part-2.aspx</link><pubDate>Wed, 23 Mar 2011 16:05:59 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:339856</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=339856</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/03/23/data-layer-11-1-sneak-peek-custom-functions-part-2.aspx#comments</comments><description>&lt;p&gt;In a &lt;a href="http://community.devexpress.com/blogs/garyshort/archive/2011/03/16/xpo-11-1-sneak-peek-custom-functions-part-1.aspx"&gt;previous blog post&lt;/a&gt; I showed you how to use custom functions everywhere you could use a CriteriaOperator. In this post, I’m going to show you how to use custom functions in LINQ to &lt;a href="http://www.devexpress.com/xpo"&gt;XPO&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;There are two interfaces that support this functionality, they are:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;i&gt;ICustomFunctionOperatorQueryable&lt;/i&gt; – which provides information about the method that will be associated with the custom function.&lt;i&gt;&lt;/i&gt; &lt;/li&gt;    &lt;li&gt;&lt;i&gt;ICustomCriteriaOperatorQueryable&lt;/i&gt; – which provides information about the method that will be associated with custom criteria, and implements the behaviour to convert a LINQ expression to a CriteriaOperator.&lt;i&gt;&lt;/i&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Right, let’s write some code! To start with let’s open the project, from the previous post, in Visual Studio 2008 or greater, set target framework to 3.5 or greater and add a reference to the DevExpress.Xpo.v11.1.Linq assembly.&lt;/p&gt;  &lt;p&gt;Next, in the MyConcatFunction class, add the implementation of &lt;em&gt;ICustomFunctionOperatorQueryable&lt;/em&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo.Helpers;
&lt;span style="color:green;"&gt;//...
&lt;/span&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MyConcatFunction &lt;/span&gt;: ICustomFunctionOperatorBrowsable, 
    ICustomFunctionOperatorFormattable, 
    ICustomFunctionOperatorQueryable 
{
    &lt;span style="color:green;"&gt;//The method name must be the same as the function name,
    //but it doesn&amp;#39;t have to be in the same class
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public static string &lt;/span&gt;MyConcat(&lt;span style="color:blue;"&gt;string &lt;/span&gt;string0, &lt;span style="color:blue;"&gt;string &lt;/span&gt;string1, &lt;span style="color:blue;"&gt;string &lt;/span&gt;string2, &lt;span style="color:blue;"&gt;string &lt;/span&gt;string3) {
        &lt;span style="color:blue;"&gt;return string&lt;/span&gt;.Concat(string0, string1, string2, string3);
    }
    &lt;span style="color:blue;"&gt;#region &lt;/span&gt;ICustomFunctionOperatorQueryable Members
     
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;System.Reflection.&lt;span style="color:#2b91af;"&gt;MethodInfo &lt;/span&gt;GetMethodInfo() {
        &lt;span style="color:blue;"&gt;return typeof&lt;/span&gt;(MyConcatFunction).GetMethod(&lt;span style="color:#a31515;"&gt;&amp;quot;MyConcat&amp;quot;&lt;/span&gt;);
    }
    &lt;span style="color:blue;"&gt;#endregion
&lt;/span&gt;}&lt;/pre&gt;

&lt;p&gt;Finally we will drop another GridControl (imaginatively called GridControl2 &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_10AF158C.png" /&gt;)&lt;strong&gt; &lt;/strong&gt;onto the form and add the following code to the form constructor:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;var &lt;/span&gt;linqResult = &lt;span style="color:blue;"&gt;from &lt;/span&gt;p &lt;span style="color:blue;"&gt;in new &lt;/span&gt;XPQuery&amp;lt;Person&amp;gt;(Session.DefaultSession)
                 &lt;span style="color:blue;"&gt;select new
                 &lt;/span&gt;{
                     p.FirstName,
                     p.LastName,
                     NameLinqToXpo =
                         MyConcatFunction.MyConcat(p.FirstName,
                         &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt;, 
                         p.LastName, 
                         &lt;span style="color:#a31515;"&gt;&amp;quot; (Linq To Xpo)&amp;quot;&lt;/span&gt;)
                 };
gridControl2.DataSource = linqResult.ToList();&lt;/pre&gt;

&lt;p&gt;Having done that, running the application will give us this result:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="Example Form showing custome functions in LINQ to XPO" border="0" alt="Example Form showing custome functions in LINQ to XPO" src="http://community.devexpress.com/blogs/garyshort/image_5B365366.png" width="745" height="391" /&gt;&lt;/p&gt;

&lt;p&gt;That’s all for this short post, until next time, happy coding! &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_10AF158C.png" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=339856" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/v2011.1+Sneak+Peek/default.aspx">v2011.1 Sneak Peek</category></item><item><title>Developer Express at DevWeek in the UK</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/03/18/developer-express-at-devweek-in-the-uk.aspx</link><pubDate>Fri, 18 Mar 2011 12:18:00 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:339424</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=339424</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/03/18/developer-express-at-devweek-in-the-uk.aspx#comments</comments><description>&lt;p&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;margin:0px 10px 10px 0px;padding-left:0px;padding-right:0px;display:inline;float:left;border-top:0px;border-right:0px;padding-top:0px;" title="IMG_2104" border="0" alt="IMG_2104" align="left" src="http://community.devexpress.com/blogs/garyshort/IMG_2104_34916204.jpg" width="244" height="184" /&gt;DevWeek is the UK’s largest developer focussed conference with some of the most respected &lt;a href="http://www.devweek.com/speakers/"&gt;speakers&lt;/a&gt; in the world in attendance. Running from the 14th-18 of March the conference combines pre-conference and post-conference workshops with days of sessions in between. This year’s sessions covered topics like: MVC, Azure, C# deep dives and Sharepoint. I’m sure you’ll agree there was enough there for every technical taste.&lt;/p&gt;  &lt;p&gt;Of course Developer Express was there in full force. We were exhibiting at the conference, which enabled me to meet a large number of DevExpress customers as well as those of you who are thinking about becoming customers. I had some great conversations at the booth on a number of great topics, including the future of WPF and Silverlight, so nothing too controversial then &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-winkingsmile_34F29930.png" /&gt;. I also demonstrated a lot of great DevExpress technology to attendees, including some of our new Silverlight stuff as well as my own first love, XAF.&lt;/p&gt;  &lt;p&gt;Not only were we exhibiting but I was lucky enough to be asked to present a session on &lt;a href="http://en.wikipedia.org/wiki/NoSQL"&gt;NoSQL&lt;/a&gt; this year. The session was standing room only as I covered the different types of NoSQL databases, before covering a range of scenarios and recommending a particular type of NoSQL database for each. I finished up with an deep dive into a use case showing how a company pulled themselves out of a situation, which could have easily cost the them their existence, with the use of a NoSQL database. The session itself was standing room only and those in attendance asked some really thought provoking questions and sparked some great conversations, some of which were carried on back at the booth, when some of the attendees sought me out for a follow up chat.&lt;/p&gt;  &lt;p&gt;Making the most of our time in London, we finished up with a great mixer event. I had a lot of fun and met a lot of interesting people and had some great conversations. Rachel has more details of this event &lt;a href="http://community.devexpress.com/blogs/rachelhawley/archive/2011/03/18/thanks-for-joining-us-at-the-devexpress-london-mixer.aspx"&gt;on her blog&lt;/a&gt;, so pop across there and check out what a great time everyone had.&lt;/p&gt;  &lt;p&gt;All and all I think DevWeek is one of the best conferences in the UK and I look forward to returning next year with the DevExpress team.&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=339424" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/Conferences/default.aspx">Conferences</category><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/DevWeek+2011/default.aspx">DevWeek 2011</category></item><item><title>Data Layer – 11.1 Sneak Peek – Custom Functions Part 1</title><link>http://community.devexpress.com/blogs/garyshort/archive/2011/03/16/xpo-11-1-sneak-peek-custom-functions-part-1.aspx</link><pubDate>Wed, 16 Mar 2011 15:22:17 GMT</pubDate><guid isPermaLink="false">bd716303-653c-428d-8b8a-a7d998cde032:339169</guid><dc:creator>Gary Short (DevExpress)</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.devexpress.com/blogs/garyshort/rsscomments.aspx?PostID=339169</wfw:commentRss><comments>http://community.devexpress.com/blogs/garyshort/archive/2011/03/16/xpo-11-1-sneak-peek-custom-functions-part-1.aspx#comments</comments><description>&lt;p&gt;One of the exciting changes that we are looking forward to shipping in 11.1, is the global registration of custom functions. Once registered, a custom function can be used where ever CriteriaOperators are processed, as well as being available in all Expression Editors.&lt;/p&gt;  &lt;p&gt;So how does it work? Simply, a custom function is a class which implements several interfaces:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;i&gt;ICustomFunctionOperator – &lt;/i&gt;is responsible for base functionality such as function name, result type and client implementation of the function.&lt;i&gt;&lt;/i&gt; &lt;/li&gt;    &lt;li&gt;&lt;i&gt;ICustomFunctionOperatorFormattable – &lt;/i&gt;is responsible for the formatting (implementation) of the function on the server (database) side.&lt;i&gt;&lt;/i&gt; &lt;/li&gt;    &lt;li&gt;&lt;i&gt;ICustomFunctionOperatorBrowsable - &lt;/i&gt;provides additional information for Expression Editors such as function category, function description, argument count etc.&lt;i&gt;&lt;/i&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;i&gt;ICustomFunctionOperatorFormattable &lt;/i&gt;and&lt;i&gt; ICustomFunctionOperatorBrowsable&lt;/i&gt; inherit from &lt;i&gt;ICustomFunctionOperator&lt;/i&gt;. So, if you implement either of first two interfaces, there is no need to implement the last.&lt;/p&gt;  &lt;p&gt;Knowing this, let’s write our own custom function to handle concatenation, let’s call it “MyConcat”&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Data.Filtering;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo.DB;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Resources;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;CustomFunctionsExample.Properties;

&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;MyConcatFunction &lt;/span&gt;: ICustomFunctionOperatorBrowsable, &lt;br /&gt;    ICustomFunctionOperatorFormattable {
    &lt;span style="color:blue;"&gt;const string &lt;/span&gt;FunctionName = &lt;span style="color:#a31515;"&gt;&amp;quot;MyConcat&amp;quot;&lt;/span&gt;;
&lt;span style="color:blue;"&gt;#region &lt;/span&gt;ICustomFunctionOperatorBrowsable Members
    &lt;span style="color:blue;"&gt;static readonly &lt;/span&gt;MyConcatFunction instance = &lt;span style="color:blue;"&gt;new &lt;/span&gt;MyConcatFunction();

    &lt;span style="color:blue;"&gt;public static void &lt;/span&gt;Register() {
        CriteriaOperator.RegisterCustomFunction(instance);
    }
    &lt;span style="color:blue;"&gt;public static bool &lt;/span&gt;Unregister() {
        &lt;span style="color:blue;"&gt;return &lt;/span&gt;CriteriaOperator.UnregisterCustomFunction(instance);
    }
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;FunctionCategory Category {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;FunctionCategory.Text; }
    }
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;Description {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;Resources.MyConcatDescription; }
    }
    &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsValidOperandCount(&lt;span style="color:blue;"&gt;int &lt;/span&gt;count) {
        &lt;span style="color:green;"&gt;// At least two operands must be specified.
        &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;count &amp;gt; 1; 
    }
    &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;IsValidOperandType(&lt;span style="color:blue;"&gt;int &lt;/span&gt;operandIndex, &lt;span style="color:blue;"&gt;int &lt;/span&gt;operandCount, Type type) {
        &lt;span style="color:green;"&gt;// All operands should be strings.
        &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;type == &lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:blue;"&gt;string&lt;/span&gt;); 
    }
    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;MaxOperandCount {
        &lt;span style="color:green;"&gt;//Accepts an infinite number of operands.
        &lt;/span&gt;&lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;-1; } 
    }
    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;MinOperandCount {
        &lt;span style="color:green;"&gt;// At least two operands must be specified.
        &lt;/span&gt;&lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;2; } 
    }
&lt;span style="color:blue;"&gt;#endregion

#region &lt;/span&gt;ICustomFunctionOperator Members

    &lt;span style="color:green;"&gt;// Evaluates the function on the client.
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public object &lt;/span&gt;Evaluate(&lt;span style="color:blue;"&gt;params object&lt;/span&gt;[] operands) {
        
        StringBuilder result = &lt;span style="color:blue;"&gt;new &lt;/span&gt;StringBuilder();
        
        &lt;span style="color:blue;"&gt;foreach&lt;/span&gt;(&lt;span style="color:blue;"&gt;string &lt;/span&gt;operand &lt;span style="color:blue;"&gt;in &lt;/span&gt;operands) {
            result.Append(operand);
        }
        
        &lt;span style="color:blue;"&gt;return &lt;/span&gt;result.ToString();
    }
    &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;FunctionName; }
    }
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Type ResultType(&lt;span style="color:blue;"&gt;params &lt;/span&gt;Type[] operands) {
        &lt;span style="color:blue;"&gt;foreach&lt;/span&gt;(Type operand &lt;span style="color:blue;"&gt;in &lt;/span&gt;operands) {
            &lt;span style="color:blue;"&gt;if&lt;/span&gt;(operand != &lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:blue;"&gt;string&lt;/span&gt;)) &lt;span style="color:blue;"&gt;return typeof&lt;/span&gt;(&lt;span style="color:blue;"&gt;object&lt;/span&gt;);
        }

        &lt;span style="color:blue;"&gt;return typeof&lt;/span&gt;(&lt;span style="color:blue;"&gt;string&lt;/span&gt;);
    }
&lt;span style="color:blue;"&gt;#endregion

#region &lt;/span&gt;ICustomFunctionOperatorFormattable Members

    &lt;span style="color:green;"&gt;// The function&amp;#39;s expression to be evaluated on the server.
    &lt;/span&gt;&lt;span style="color:blue;"&gt;public string &lt;/span&gt;Format(Type providerType, &lt;span style="color:blue;"&gt;params string&lt;/span&gt;[] operands) {

        &lt;span style="color:green;"&gt;// This example implements the function for MS Access databases only.
        &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt;(providerType == &lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(AccessConnectionProvider)) {
            StringBuilder result = &lt;span style="color:blue;"&gt;new &lt;/span&gt;StringBuilder();
            result.Append(&lt;span style="color:#a31515;"&gt;&amp;quot;(&amp;quot;&lt;/span&gt;);
            &lt;span style="color:blue;"&gt;for&lt;/span&gt;(&lt;span style="color:blue;"&gt;int &lt;/span&gt;i = 0; i &amp;lt; operands.Length; i++) {
                &lt;span style="color:blue;"&gt;if&lt;/span&gt;(i &amp;gt; 0) result.Append(&lt;span style="color:#a31515;"&gt;&amp;quot; + &amp;quot;&lt;/span&gt;);
                result.AppendFormat(&lt;span style="color:#a31515;"&gt;&amp;quot;({0})&amp;quot;&lt;/span&gt;, operands[i]);
            }
            result.Append(&lt;span style="color:#a31515;"&gt;&amp;quot;)&amp;quot;&lt;/span&gt;);
            &lt;span style="color:blue;"&gt;return &lt;/span&gt;result.ToString();
        }
        &lt;span style="color:blue;"&gt;throw new &lt;/span&gt;NotSupportedException(providerType.FullName);
    }
}&lt;/pre&gt;

  &lt;p&gt;&lt;font size="1" face="Verdana"&gt;In the code above the Register and Unregister methods simplify the global registration process of our custom function whilst the &lt;/font&gt;Description property of the &lt;i&gt;MyConcatFunction&lt;/i&gt; class returns a description for our custom function, which we fetch from our resources. This example implements formatting for MS Access only.&lt;/p&gt;

  &lt;p&gt;Having done this, let’s write a Person persistent class:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Next let&amp;#39;s write the persistent class &lt;i&gt;Person&lt;/i&gt;.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;DevExpress.Xpo;
&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Person&lt;/span&gt;: XPBaseObject {
    &lt;span style="color:blue;"&gt;int &lt;/span&gt;oid;
    [Key(&lt;span style="color:blue;"&gt;true&lt;/span&gt;)]
    &lt;span style="color:blue;"&gt;public int &lt;/span&gt;Oid {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;oid; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{ SetPropertyValue&amp;lt;&lt;span style="color:blue;"&gt;int&lt;/span&gt;&amp;gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Oid&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;oid, &lt;span style="color:blue;"&gt;value&lt;/span&gt;); }
    }
    &lt;span style="color:blue;"&gt;string &lt;/span&gt;firstName;
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;FirstName {
        &lt;span style="color:blue;"&gt;get &lt;/span&gt;{ &lt;span style="color:blue;"&gt;return &lt;/span&gt;firstName; }
        &lt;span style="color:blue;"&gt;set &lt;/span&gt;{ SetPropertyValue&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;firstName, &lt;span style="color:blue;"&gt;value&lt;/span&gt;); }
    }
    &lt;span style="color:blue;"&gt;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&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt;(&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:green;"&gt;//Using our custom function in PersistentAlias
    &lt;/span&gt;[PersistentAlias(&lt;span style="color:#a31515;"&gt;&amp;quot;MyConcat(FirstName, &amp;#39; &amp;#39;, LastName, &amp;#39; 1&amp;#39;)&amp;quot;&lt;/span&gt;)]
    &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;(&lt;span style="color:blue;"&gt;string&lt;/span&gt;)EvaluateAlias(&lt;span style="color:#a31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;); }
    }
    &lt;span style="color:blue;"&gt;public &lt;/span&gt;Person(Session session) : &lt;span style="color:blue;"&gt;base&lt;/span&gt;(session) { }
}&lt;/pre&gt;

&lt;p&gt;As you can see, in the Name property, we are using our new custom function in the same way as we would use a built-in function.&lt;/p&gt;

&lt;p&gt;Next, we’ll add function registration into the &lt;i&gt;Main &lt;/i&gt;method of the &lt;i&gt;Program&lt;/i&gt; class:&lt;/p&gt;

&lt;pre class="code"&gt;[STAThread]
&lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main() {
    MyConcatFunction.Register();
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(&lt;span style="color:blue;"&gt;false&lt;/span&gt;);
    Application.Run(&lt;span style="color:blue;"&gt;new &lt;/span&gt;Form1());
}&lt;/pre&gt;

&lt;p&gt;Now, let’s create a new form and drop the &lt;b&gt;GridControl(gridControl1)&lt;/b&gt;, &lt;b&gt;Session(session1)&lt;/b&gt;and &lt;b&gt;XPView(xpView1) &lt;/b&gt;components onto it, then set the &lt;b&gt;Session &lt;/b&gt;property of the &lt;b&gt;xpView1 to session1&lt;/b&gt;. After that we will add properties (Name - Property accordingly) to &lt;b&gt;xpView1&lt;/b&gt; as shown below:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;FirstName - [FirstName] &lt;/li&gt;

  &lt;li&gt;LastName - [LastName] &lt;/li&gt;

  &lt;li&gt;NamePersistentAlias - [Name] &lt;/li&gt;

  &lt;li&gt;NameViewProperty - MyConcat([FirstName], &amp;#39; &amp;#39;, [LastName], &amp;#39; 2&amp;#39;) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="ViewProperty Collection Editor" border="0" alt="ViewProperty Collection Editor" src="http://community.devexpress.com/blogs/garyshort/image_193F78CE.png" width="676" height="443" /&gt;&lt;/p&gt;

&lt;p&gt;Here we use the &lt;i&gt;MyConcat&lt;/i&gt; function in the &lt;i&gt;ViewProperty&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;Now let’s select &lt;b&gt;xpView1&lt;/b&gt; as a data source of the &lt;b&gt;gridControl1 &lt;/b&gt;component&lt;b&gt;,&lt;/b&gt; run the designer for &lt;b&gt;gridControl1 &lt;/b&gt;and add a column with following properties:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Caption = Name (Unbound Expression) &lt;/li&gt;

  &lt;li&gt;FieldName = &lt;b&gt;name of the column&lt;/b&gt; &lt;/li&gt;

  &lt;li&gt;ShowUnboundExpressionMenu = True &lt;/li&gt;

  &lt;li&gt;UnboundExpression = [MyConcat]([FirstName], &amp;#39; &amp;#39;, [LastName], &amp;#39; 3&amp;#39;) &lt;/li&gt;

  &lt;li&gt;UnboundType = String &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally add the following code into the form constructor:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;[][] names = &lt;span style="color:blue;"&gt;new string&lt;/span&gt;[][] {
    &lt;span style="color:blue;"&gt;new string&lt;/span&gt;[] { &lt;span style="color:#a31515;"&gt;&amp;quot;John&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Smith&amp;quot; &lt;/span&gt;},
    &lt;span style="color:blue;"&gt;new string&lt;/span&gt;[] { &lt;span style="color:#a31515;"&gt;&amp;quot;Fred&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Scott&amp;quot; &lt;/span&gt;},
    &lt;span style="color:blue;"&gt;new string&lt;/span&gt;[] { &lt;span style="color:#a31515;"&gt;&amp;quot;James&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;King&amp;quot; &lt;/span&gt;}
};

&lt;span style="color:blue;"&gt;using&lt;/span&gt;(UnitOfWork uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;UnitOfWork()) {
    XPCollection&amp;lt;Person&amp;gt; persons = &lt;span style="color:blue;"&gt;new &lt;/span&gt;XPCollection&amp;lt;Person&amp;gt;(uow);
    uow.Delete(persons);
    uow.CommitChanges();
}

&lt;span style="color:blue;"&gt;using&lt;/span&gt;(UnitOfWork uow = &lt;span style="color:blue;"&gt;new &lt;/span&gt;UnitOfWork()) {
    &lt;span style="color:blue;"&gt;for&lt;/span&gt;(&lt;span style="color:blue;"&gt;int &lt;/span&gt;i = 0; i &amp;lt; names.Length; i++) {
        Person person = &lt;span style="color:blue;"&gt;new &lt;/span&gt;Person(uow);
        person.FirstName = names[i][0];
        person.LastName = names[i][1];
    }
    uow.CommitChanges();
}&lt;/pre&gt;

&lt;p&gt;Then run the application to see the results:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="Sample App" border="0" alt="Sample App" src="http://community.devexpress.com/blogs/garyshort/image_0AB456DC.png" width="745" height="287" /&gt;&lt;/p&gt;

&lt;p&gt;Now that the application is running, you can select the function, from the list within the Unbound Expression Editor. To invoke this editor, click the corresponding item in the context menu for the &amp;quot;Name (UnboundExpression)&amp;quot; column.&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="Expression Editor" border="0" alt="Expression Editor" src="http://community.devexpress.com/blogs/garyshort/image_2E8D0869.png" width="602" height="479" /&gt;&lt;/p&gt;

&lt;p&gt;As you can see, our new function is listed!&lt;/p&gt;

&lt;p&gt;Well that’s all for this post, ‘til next time happy coding! &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://community.devexpress.com/blogs/garyshort/wlEmoticon-smile_1041CE0E.png" /&gt;&lt;/p&gt;&lt;img src="http://community.devexpress.com/aggbug.aspx?PostID=339169" width="1" height="1"&gt;</description><category domain="http://community.devexpress.com/blogs/garyshort/archive/tags/v2011.1/default.aspx">v2011.1</category></item></channel></rss>