<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developers.de/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>Damir Dobric Posts : Architecture and Modeling, AppFabric, cloud</title><link>http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/AppFabric/cloud/default.aspx</link><description>Tags: Architecture and Modeling, AppFabric, cloud</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>Power of Windows Azure PaaS: State Share and Persistence in the cloud</title><link>http://developers.de/blogs/damir_dobric/archive/2013/04/22/state-share-and-persistence-in-the-cloud.aspx</link><pubDate>Mon, 22 Apr 2013 13:00:00 GMT</pubDate><guid isPermaLink="false">7e491611-45ad-4dae-a68f-c4cb64439510:524764</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=524764</wfw:commentRss><comments>http://developers.de/blogs/damir_dobric/archive/2013/04/22/state-share-and-persistence-in-the-cloud.aspx#comments</comments><description>&lt;p&gt;If you are experienced enterprise developer who targets the Microsoft platform, you have probably at least once in your have a requirement to share some state across different instance of an application.    &lt;br /&gt;But, if you are hobby developer or any other professional developer, who possible do not focus distributed systems, you will might find the term “State” in context of persistence a pure theory thing.     &lt;br /&gt;So who ever you are, let’s start with a simple theory thing.     &lt;br /&gt;Imaging you have in theory a trivial application (today I call such applications simply “apps”). Assume this is an app running on smart phone or any other mobile device. This app has a variable ‘A’ and value assigned to this variable ‘1’. This value is not the default value. It is rather the value which user has assigned at some point of time.     &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_010BAA6F.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_59652E44.png" width="158" height="152" /&gt;&lt;/a&gt;     &lt;br /&gt;    &lt;br /&gt;Now, imagine the application crashes and you start it again. The value of variable A is obviously lost. If you want to keep this value somewhere, so it can be loaded even if application crashes. We call that usually persistence. Depending on application and your skill, there are several ways to persists the value of an variable. For example you can use any kind of local cache, like a file system.     &lt;br /&gt;    &lt;br /&gt;But what if your application has to survive the hardware damage? Or what if your application is consisted multiple clients which have to share the same value? In this case you will have to use some kind of database.     &lt;br /&gt;As long you are in control of your infrastructure (means application is deployed in your enterprise) you can use some database to persist the value. The good example of this is Workflow Foundation. Long running processes require by default the state persistence.     &lt;br /&gt;Unfortunately we have more often scenarios where applications are distributed across the web. In such cases the only sharing artifact between such applications is the cloud. Following picture shows&amp;#160; how two apps (or applications) share their state through the cloud.     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_5245F1CC.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_7914080C.png" width="578" height="157" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;This is a nice theoretical case which is practically a horror to implement. I strongly believe that today we are implicitly preparing for dominance of devices in the web. In this hypothetical scenario both devices (see picture above) should act as services to be able to share their state. If you are distributed application or integration developer you know that connectivity us such scenarios is a big, big issue. Or simply, it is the fact, devices in the web have a private IP address and because of that they are not reachable by anybody. So if the microscope on the left cannot reach the smart-phone on the right, the state from left to right cannot be propagated and vice versa.    &lt;br /&gt;    &lt;br /&gt;If this to theoretical to you, imagine just a service which is running distributed across cloud. This might be WCF service, Windows Service (running in SCM) or even Web Api based service. Whatever technology you peek, it does not matter. The only important thing is that you want run multiple instances of the service, but on two machines which are not in the same environment (if they are in the same environment even better). So that means, independent on a case, devices or services or both, we have the same requirement:&lt;/p&gt;  &lt;p&gt;1. Sharing of the state between applications distributed in the web    &lt;br /&gt;2. Persisting of the state without database.&lt;/p&gt;  &lt;p&gt;You believe or not, this problem can be solved by using Windows Azure Service Bus, which in this case plays a role of cloud artifact. To illustrate how this can work, take a look on following example.    &lt;br /&gt;This is a console application in C#. The state which should be shared and persisted across many applications is stared in variable State. &lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;class&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;Program&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;{ &lt;/span&gt;            &lt;p&gt;&lt;/p&gt;         &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;public&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;static&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;WebState&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;string&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;gt; State { &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;get&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;set&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;; }&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;            &lt;p&gt;&amp;#160;&lt;/p&gt;         &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;static&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;void&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; Main(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;string&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;[] args)              &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{ &lt;/span&gt;            &lt;p&gt;&lt;/p&gt;         &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;State = &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;new&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;WebState&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;string&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;ConfigurationManager&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.AppSettings[&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;SbConnStr&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;],&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;BusinessDomain&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;, &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;ConfigurationManager&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.AppSettings[&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;Node&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;]);              &lt;br /&gt;              &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;/span&gt;            &lt;p&gt;&amp;#160;&lt;/p&gt;         &lt;/p&gt;         &lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;State.StateChanged += State_StateChanged;             &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;Console&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.WriteLine(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;I&amp;#39;m node with name: &amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; + &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;ConfigurationManager&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.AppSettings[&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;Node&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;]);            &lt;p&gt;&lt;/p&gt;         &lt;/span&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;/span&gt;            &lt;p&gt;&amp;#160;&lt;/p&gt;         &lt;/p&gt;         &lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;Console&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.WriteLine(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;Running with state: {0}&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;, State.Value);            &lt;p&gt;&lt;/p&gt;         &lt;/span&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;/span&gt;            &lt;p&gt;&amp;#160;&lt;/p&gt;         &lt;/p&gt;         &lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;while&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; (&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;true&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;)            &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{             &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;State.Value = &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;Console&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.ReadLine();            &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}             &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}             &lt;p&gt;&lt;/p&gt;         &lt;/span&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;/span&gt;            &lt;p&gt;&amp;#160;&lt;/p&gt;         &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;static&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;void&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; State_StateChanged(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;object&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt; sender, &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;WebStateEventArg&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;mso-ansi-language:en-us;"&gt;string&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;gt; e)              &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{               &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;Console&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;.WriteLine(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;mso-ansi-language:en-us;"&gt;&amp;quot;State changed by {0} at value: {1}&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;, e.InstanceName, e.NewValue);              &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;}&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt; &lt;/span&gt;            &lt;p&gt;&amp;#160;&lt;/p&gt;         &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;line-height:115%;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}&lt;/span&gt; &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;As you see this variable is of type &lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#2b91af;mso-highlight:white;mso-ansi-language:en-us;"&gt;WebState&lt;/span&gt;, which is implemented by me. When you start this&amp;#160; application, enter some text on the console. The text will be immediately persisted in the cloud after following line of code is executed:     &lt;br /&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;mso-ansi-language:en-us;"&gt;     &lt;br /&gt;State.Value = …&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;Now stop the application gracefully and start it again. You will notice that application write out the value which was as last one persisted. In fact event with one participant in the system you have achieved the persistence.    &lt;br /&gt;The magic behind this is implemented on top of Windows Azure Service Bus queues. Each time the value is changed, the WebState implementation receives the existing message from the queue and put back the new message in the queue which basically holds the serialized value of variable State, and so on. Because access to the queue is session based, Service Bus guaranties that no any other applications which shares this value, will access the queue in the same time. I don’t want to call this distributed transaction, but it behaves in persistence this scenario like it would be one. In fact the WebState class uses the Queue as a unit of storage. By reading and immediate writing back of the new value, it is guarantied that the queue holds one and only one message all the time.     &lt;br /&gt;Following picture illustrate this. Each time the value i changed the old value is stored in the queue as a message. The old value is received from queue and the new message with new value is sent to the queue. At the end the old one is completed, because &lt;em&gt;PeekAndLock&lt;/em&gt; receive is used.When the new instance of the State is created (for example when application is started) the same cycle with receive/send is done. This is how multiple applications obtain there actual state.     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_1FE21E4D.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_11A3A55D.png" width="657" height="492" /&gt;&lt;/a&gt;     &lt;br /&gt;Additionally the implementation of the WebState takes a care about state sharing. For this purpose there is a topic used to share state changes. All participants in this distributed system have to create a subscription on that topic.     &lt;br /&gt;In this case (see picture below) the new value is published as a message to the topic. After that all subscribers can receive the message with the new value. The publishing process additionally updates the new value in the persistence queue from previous example.     &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_7F5ADE9A.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;margin-left:0px;display:inline;border-top-width:0px;margin-right:0px;" border="0" alt="image" align="left" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_2A3342AD.png" width="857" height="525" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Because topic-subscriptions are used, the application which was not running for a while, will automatically receive all state changes which have happened in the mean time.    &lt;br /&gt;    &lt;br /&gt;This examples shows how complex patterns can be implemented by using connectivity service in Windows Azure. I know that majority of people out there still think a..bout cloud as an old thing. There is also a group of people who thinks that cloud is unsafe think to keep the data. If you are one them them please rethink your thinking. The scenario and solution shown above is a new way of thinking and using cloud services. And the nice think here is that practically no real data is stored in the cloud.     &lt;br /&gt;As you see, the cloud is more than solely putting of some application online. :)     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;The code for this will be published soon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=524764" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/default.aspx">Architecture and Modeling</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Integration/default.aspx">Integration</category></item><item><title>How to sign up for preview features?</title><link>http://developers.de/blogs/damir_dobric/archive/2012/06/09/how-to-sign-up-for-preview-features.aspx</link><pubDate>Sat, 09 Jun 2012 10:08:20 GMT</pubDate><guid isPermaLink="false">7e491611-45ad-4dae-a68f-c4cb64439510:308121</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=308121</wfw:commentRss><comments>http://developers.de/blogs/damir_dobric/archive/2012/06/09/how-to-sign-up-for-preview-features.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Windows Azure “spring release” 2012 provides few new features: like media service, virtual machine (with real persistence), and Web Sites.&lt;/p&gt;  &lt;p&gt;&lt;img alt="Windows Azure Media Services" src="http://www.windowsazure.com/css/images/betafeatures/mediaservices/Stream_LRG.png" /&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Media Services&lt;/h2&gt;  &lt;p&gt;Windows Azure Media Services enable solution providers and content owners to build end-to-end workflows for the creation, management, and distribution of media. Combining core components of the Microsoft Media Platform, Media Services include Encoding, Format Conversion, Content Protection, On-Demand Streaming, and Live Streaming. Solutions built on Media Services offer the flexibility, scalability, and reliability to deliver high quality media experiences to a global audience. &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;   &lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/clip_5F00_image001_5F00_436D0475.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="clip_image001" border="0" alt="clip_image001" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/clip_5F00_image001_5F00_thumb_5F00_1C32BB40.png" width="124" height="124" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Virtual Machines &amp;amp; Virtual Networks&lt;/h2&gt;  &lt;p&gt;Easily deploy and run Windows Server and Linux virtual machines in Windows Azure. Windows Azure Virtual Machines allow you to migrate applications and infrastructure without having to change existing code. You can also create your own virtual private networks (VPNs) in Windows Azure and securely connect them to on-premises IT infrastructure with Windows Azure Virtual Network. You can extend your on-premises networks into the cloud with control over network topology, including configuration of IP addresses and DNS. &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;   &lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/clip_5F00_image002_5F00_57F253F3.png"&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="clip_image002" border="0" alt="clip_image002" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/clip_5F00_image002_5F00_thumb_5F00_50D3177B.png" width="124" height="124" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Web Sites (also called Web Site as a Service)&lt;/h3&gt;  &lt;p&gt;Quickly and easily deploy sites to a highly scalable cloud environment with the frameworks and open source apps of your choice using Windows Azure Web Sites. Get started for free and scale as you go on a cloud platform that enables automatic scale-out options across shared and reserved instances for greater isolation and performance. &lt;/p&gt;  &lt;p&gt;If you like to take a look on the preview: &lt;a title="https://account.windowsazure.com/PreviewFeatures" href="https://account.windowsazure.com/PreviewFeatures"&gt;https://account.windowsazure.com/PreviewFeatures&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=308121" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/default.aspx">Architecture and Modeling</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category></item><item><title>WinDays 2012 KeyNote Demo Step Through</title><link>http://developers.de/blogs/damir_dobric/archive/2012/05/12/windays-2012-keynote-demo-step-through.aspx</link><pubDate>Sat, 12 May 2012 11:54:46 GMT</pubDate><guid isPermaLink="false">7e491611-45ad-4dae-a68f-c4cb64439510:302562</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=302562</wfw:commentRss><comments>http://developers.de/blogs/damir_dobric/archive/2012/05/12/windays-2012-keynote-demo-step-through.aspx#comments</comments><description>&lt;p&gt;   &lt;br /&gt;Few days ago I showed the Demo at &lt;a href="http://www.windays.hr/hr/naslovna/"&gt;WinDays&lt;/a&gt; 2012 keynote under the name “SharePoint Ralay”. The idea of the keynote was to show some important features which never have been shown or documented in the way as of very one common industry scenario. To keep things simple we didn’t go to deep into details of SharePoint and ServiceBus. We wanted to to build a demo which will show how to build few complex and enterprise relevant scenarios, but to be in the same time interesting for most developers in audience and even for journalists who have been attending the key note.     &lt;br /&gt;So I decided to target three common industrial issues which daenet has been asked to solve multiple times during 2011:&lt;/p&gt;  &lt;p&gt;1. How to get (or put) SharePoint data out of enterprise without changing of infrastructure?    &lt;br /&gt;2. How to build dynamic WCF contract?     &lt;br /&gt;3. How to build Failover cluster in 48 Seconds?&lt;/p&gt;  &lt;h4&gt;1. How to get/put data out of SPS without changing of infrastructure?&lt;/h4&gt;  &lt;p&gt;Most SharePoint Developers live in their collaborative context which mostly does not require such scenarios. But when building SharePoint solutions you will figure out that SharePoint isn’t application platform in term how one solution or enterprise architect expect to be. Today, complex systems are systems which consist of usually distributed and hybrid hybrid applications.Distributed means they at least do not run in one process and hybrid means they can be build on top of different technologies.    &lt;br /&gt;So, imagine now one application which is build in .NET 4.5 which should run in SharePoint. To make it more simpler image a JAVA application which runs at different machine on different geographic location. Now put it in SharePoint and let talk to each other. Application Platform is the platform which enables to do such things. Any other application platform like SharePoint, CRM, BizTalk or anything else is a platform of their own definition with huge limitations. Because of that be careful, when you say platform. “&lt;em&gt;One can be a boss in his village, but just some little peace in the global world”&lt;/em&gt;. The part of Microsoft which build such platforms is called Business Platform Division.     &lt;br /&gt;    &lt;br /&gt;So, let’s get now some data out of SharePoint in context of&amp;#160; distributed application scenario. First of all in the world of distributed thinking, you should never allow external parties get in touch with your platform directly. To illustrate this constraint, think on giving the public access to your database. You will probably never allow somebody to send you DB-commands which will be executed against your DB (SQL Injections etc..). If you do it it is wrong and please think change it.. By following the same rule you shouldn’t let anybody to dig in your SharePoint platform for the same reason. You even should not share the secret, that you platform is SPS.     &lt;br /&gt;    &lt;br /&gt;The easiest way is to provide some kind of intermediary component which will abstract the business scenario over secret platform which is running in the background. The technology which does exactly this job is WCF. We will put WCF service between SPS and external party. At some point of time when you have lot of such services, you can start to talk about Middle-Ware. This is a fine solution, but there is a still one practical problem.     &lt;br /&gt;    &lt;br /&gt;The service contract could look in our case as shown below:     &lt;br /&gt;    &lt;br /&gt;    &lt;table cellspacing="0" cellpadding="2"&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;[ServiceContract(Name = &amp;quot;EchoContract&amp;quot;, Namespace = &amp;quot;&lt;a href="http://samples.microsoft.com/ServiceModel/Relay/&amp;quot;)]"&gt;http://samples.microsoft.com/ServiceModel/Relay/&amp;quot;)]&lt;/a&gt;               &lt;br /&gt;&amp;#160; public interface ISpsRelayService               &lt;br /&gt;&amp;#160; {               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [OperationContract]               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; List&amp;lt;MyEntity&amp;gt; Query(QueryEntity query);               &lt;br /&gt;&amp;#160; } &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;You should define the QueryEntity which somehow describes what you want. SPS developer would like to to see here probably SPS- “ClientObjects”. Unfortinatelly they have never been designed for such scenarios. They can only be used by explicit helper libraries. Such libraries do not work out of SharePoint and their dependent entities are not serializable.     &lt;br /&gt;But never mind, define your entities like your business needs them (see service contract above).     &lt;br /&gt;    &lt;br /&gt;The service implementation (see code below) will read the QueryEntity instance and build appropriate SPS-query (not shown in the demo below).     &lt;br /&gt;After all we will call SPS WebService hosted internally in our enterprise at &lt;a title="http://yourhost:44445" href="http://yourhost:44445"&gt;http://yourhost:44445&lt;/a&gt; and finally build response as collection of &lt;em&gt;MyEntity&lt;/em&gt; instances.     &lt;br /&gt;This service decouples the SPS from external parties and provides very simple and business related contract as usual in the SOA world.     &lt;br /&gt;Following code snippet shows how to implement the service which gets documents from some SharePOint library and returns them as collection to the external party. In fact this is nothing very complicated (not yet)..&lt;/p&gt;  &lt;p&gt;   &lt;table cellspacing="0" cellpadding="2"&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;br /&gt;            &lt;p&gt;public List&amp;lt;MyEntitity&amp;gt; Query(QueryEntity query)              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ClientContext clientContext = new ClientContext(&amp;quot;&lt;a href="http://yourhost:44445&amp;quot;);"&gt;http://yourhost:44445&amp;quot;);&lt;/a&gt;&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Web oWebsite = clientContext.Web;              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var files = oWebsite.GetFolderByServerRelativeUrl(&amp;quot;/Shared%20Documents&amp;quot;).Files;               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; clientContext.Load(files);               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; clientContext.ExecuteQuery();&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; List&amp;lt;MyEntitity&amp;gt; items = new List&amp;lt;MyEntitity&amp;gt;();&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; foreach (var doc in files)              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; dynamic o = new MyEntitity();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.Name = doc.Name;               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.Something = DateTime.Now.Ticks;               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.Version = doc.UIVersionLabel;&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; items.Add(o);              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return items;              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;To make it available in the internet this service needs to have a public endpoint accessible by the external party. And exactly this is the change demand in infrastructure which is very, very often an organizational issue or even “No go”. First somebody hast to give you an public IP address, then you need to configure NAT and DNS&amp;#160; for it, then Security, port mapping from probably 80 to 4445 etc., etc..    &lt;br /&gt;I want to build some kind of VPN between my WCF (talking to SPS) and external caller, but without changing any piece of infrastructure. The next picture shows this scenario. Windows Azure provides a platform service called “&lt;a href="http://www.windowsazure.com/en-us/home/features/service-bus/"&gt;Service Bus&lt;/a&gt;”. This one provides a feature called relying. Relaying can connect two participants directly thorough firewall. Two participants are connected through Service Bus intermediary by using bidirectional TCP connection, which remains open after once is established.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_52E91BC8.png"&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://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_37DC5E88.png" width="856" height="561" /&gt;&lt;/a&gt;     &lt;br /&gt;    &lt;br /&gt;Following code shows how to start-up the service which will listen on Service-Bus packets and relay SharePoint to external caller.&lt;/p&gt;  &lt;p&gt;   &lt;table cellspacing="0" cellpadding="2"&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;static void Main(string[] args)              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ServicePointManager.ServerCertificateValidationCallback = validateServerCert;&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the service URI based on the service namespace which you will obtain when creating the              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // service bus namespace.               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Uri address = ServiceBusEnvironment.CreateServiceUri(&amp;quot;https&amp;quot;, serviceNamespaceDomain, &amp;quot;SpsRelayService/DocumentLibrary&amp;quot;);&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the credential object for the endpoint              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sharedSecretServiceBusCredential.TokenProvider = TokenProvider.CreateSharedSecretTokenProvider(issuerName, issuerSecret);&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the service host reading the configuration              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ServiceHost host = new ServiceHost(typeof(SpsRelayService), address);&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the ServiceRegistrySettings behavior for the endpoint              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings()               &lt;br /&gt;{ DisplayName = &amp;quot;Sharepoint Relay Document Library Service&amp;quot;, DiscoveryMode = DiscoveryType.Public };               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; foreach (ServiceEndpoint endpoint in host.Description.Endpoints)               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {               &lt;br /&gt;              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // add the Service Bus credentials to all endpoints specified in configuration               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; endpoint.Behaviors.Add(sharedSecretServiceBusCredential);               &lt;br /&gt;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // Optionally you can add the URI in the registry.               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; endpoint.Behaviors.Add(serviceRegistrySettings);               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // Open the service              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; host.Open();&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.ForegroundColor = ConsoleColor.Cyan;&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;Service address: &amp;quot; + address);              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;Press [Enter] to exit&amp;quot;);               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.ReadLine();&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // close the service              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; host.Close();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }               &lt;br /&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;Similarly, external party will also establish the connection as shown in the next snippet:    &lt;br /&gt;    &lt;br /&gt;    &lt;table cellspacing="0" cellpadding="2"&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p&gt;static void Main(string[] args)              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ServicePointManager.ServerCertificateValidationCallback = validateServerCert;&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the service URI based on the service namespace              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Uri address = ServiceBusEnvironment.CreateServiceUri(&amp;quot;https&amp;quot;, serviceNamespaceDomain, &amp;quot;SpsRelayService/DocumentLibrary&amp;quot;);&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the credential object for the endpoint              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sharedSecretServiceBusCredential.TokenProvider = TokenProvider.CreateSharedSecretTokenProvider(issuerName, issuerSecret);&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the channel factory loading the configuration              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ChannelFactory&amp;lt;ISpsRelayService&amp;gt; channelFactory = new ChannelFactory&amp;lt;ISpsRelayService&amp;gt;(&amp;quot;RelayEndpoint&amp;quot;, new EndpointAddress(address));&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // apply the Service Bus credentials              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; channelFactory.Endpoint.Behaviors.Add(/*swtBehavior*/sharedSecretServiceBusCredential);&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create and open the client channel              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ISpsRelayService channel = channelFactory.CreateChannel();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ((ICommunicationObject)channel).Open();&lt;/p&gt;            &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;Enter text to echo (or [Enter] to exit):&amp;quot;);              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string input = Console.ReadLine();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; List&amp;lt;MyEntity&amp;gt; res = channel.Query(new QueryEntity(){…});               &lt;br /&gt;              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ((ICommunicationObject)channel).Close();               &lt;br /&gt;              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; channelFactory.Close();               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }               &lt;br /&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;If you ever worked with WCF there is not much more to say. The code shown above contains a bit sugar around standard WCF.Everything else is a matter of channel which is hidden behind RelayBinding. For more information about ports in use take a look &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee732535.aspx"&gt;here&lt;/a&gt;.     &lt;br /&gt;Following binding must be configured in both service and client.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p&gt;&amp;lt;bindings&amp;gt;            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;basicHttpRelayBinding&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;binding name=&amp;quot;myBinding&amp;quot;&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;security mode=&amp;quot;Transport&amp;quot;/&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/binding&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/basicHttpRelayBinding&amp;gt;             &lt;br /&gt;&amp;#160; &amp;lt;/bindings&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160; &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;After you start service and then client,the client will send the request to service through firewall. The service will get data out of SPS and relay it back to the client.&lt;/p&gt;  &lt;h4&gt;2. How to build dynamic WCF contract? &lt;/h4&gt;  &lt;p&gt;In the world of SOA you always should build a clear contract between two boundaries. That means contracts like following one are not well designed:    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;&lt;em&gt;Message Operation(Message msg);        &lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;    &lt;br /&gt;I have also seen in some projects following variant of the similar contract, which is semantically the same one as previous one:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;string Operation(string msg);&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;By using such contract the client has no way to know how to serialize the message. Even after the service version is changed, there is no way to communicate this to anybody instead of verbal human communication which is time intensive and error prone. Compare it with “add service reference” to create the proxy. The client and service must in such cases implement code which serializes/deserializes respectively the message (string).    &lt;br /&gt;In other words, using service contracted this way is called “&lt;strong&gt;&lt;em&gt;Anti-Pattern&lt;/em&gt;&lt;/strong&gt;”, which should not be used in the SOA world.     &lt;br /&gt;    &lt;br /&gt;Many developers think they can build SOA solution if they are just able to build WCF based service. This is a mistake. When you use WCF it doesn’t mean at all that you are by default SOAP capable.&amp;#160; In our scenario I will use out this fact as my advantage. Connecting external party to our relay service is not SOA focused scenario. It is more about classical EAI and not SOA. Such kind of connecting system is known as interface with point-to-point connection. This is also not the best pattern in the world of SOA (I mean point2point interface).&amp;#160; and it should b e avoided when building middle-wares. But this is another story.     &lt;br /&gt;&amp;#160; &lt;br /&gt;In other words, If you are connecting two systems as point2poin it might be valid to apply SOA anti-pattern.This is in context of SOA an anti-pattern, but not an anti-pattern in universe of possible solutions. If you have two parties talking to each other then you can often change the contract between them without of too much organizational difficulties.If you are changing often the contract (in our case &lt;em&gt;MyEntity&lt;/em&gt; and &lt;em&gt;MyQuery&lt;/em&gt;) it is easier to make it dynamic. In this case you can build it once without need to change it in the future, because it is dynamic one. Following example shows how to use &lt;strong&gt;&lt;em&gt;ExpandoObject&lt;/em&gt;&lt;/strong&gt; to build dynamic WCF contract. If you don’t know what this is take a look on &lt;a href="http://blogs.msdn.com/b/csharpfaq/archive/2009/10/01/dynamic-in-c-4-0-introducing-the-expandoobject.aspx"&gt;Alexandra’s&lt;/a&gt;&amp;#160; and &lt;a href="http://www.west-wind.com/weblog/posts/2012/Feb/08/Creating-a-dynamic-extensible-C-Expando-Object"&gt;Rick’&lt;/a&gt;s posts.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p&gt;ServiceContract(Name = &amp;quot;SpsRelayContract&amp;quot;, Namespace = &amp;quot;&lt;a href="http://daenet.deServiceModel/Relay/&amp;quot;)]"&gt;http://daenet.deServiceModel/Relay/&amp;quot;)]&lt;/a&gt;             &lt;br /&gt;&amp;#160; public interface ISpsRelayService             &lt;br /&gt;&amp;#160; {             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [OperationContract]             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; List&amp;lt;&lt;font color="#0000ff"&gt;ExpandoObject&lt;/font&gt;&amp;gt; Query(&lt;font color="#0000ff"&gt;ExpandoObject&lt;/font&gt; expression);             &lt;br /&gt;&amp;#160; } &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;The good thing on Expando-contract is that you can do something like this:    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff"&gt;dynamic&lt;/font&gt; o = new &lt;font color="#0000ff"&gt;ExpandoObject&lt;/font&gt;();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.Name = “bla bla”;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.Something = DateTime.Now.Ticks;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.Method= new SomeDelegate(someMethod);     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;You can set on this object whatever property you want (more or less). But&amp;#160; note in a case of WCF the method instance as property wouldn’t make a sense, because that instance will not exist on some other process and some other machine. However all other properties can be set as you like. And WCF will serialize them automatically for you. In other words, if you have a new property you don’t have to change contract. You just set it like:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;o.NewPropery = 17;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The consumer of this value just hast to know that is there (because,. remember, there is not clear contract, Add-Reference or SVCUTIL). &lt;/p&gt;  &lt;p&gt;As a recap, note that ExpandoObject provides a dynamic contract. Build your Service on top of this entity and you will not have to change the contract when new properties are added in the business scenario, which service implements. Remember that this is not a SOA capable solution, but it is valid to build Point-To-Point scenarios when one party is connecting to another one.&lt;/p&gt;  &lt;h3&gt;3. How to build Failover cluster in 48 Seconds?&lt;/h3&gt;  &lt;p&gt;Last but not least I there is an issue which has been mostly forgotten in almost all our discussion when building relaying scenarios. I every project you will reach a point when the solution has to be deployed in the production. Then you will ask yourself how to build redundancy based on relying? This means, you want to provide a fail-over instance of you WCF relaying service which will be used when the first one is not reachable. The picture shown bellow illustrates this requirement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_2B661361.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_2B161807.png" width="540" height="441" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To make this working you really do not have to change any peace of infrastructure. Just start the another instance of the service on another machine. That’s all. This will work by using both protocols TCP and HTTP. There are currently few undocumented differences in routing when using different protocols, nut in general both will provide you the stable and reliable fail-over mechanism.&lt;/p&gt;  &lt;p&gt;Remark: If you are demoing this scenario with both WCF-instances on one machine, the basicHttpRelayBinding will not work with out-of-the-box configuration, because both instances will try to start listening for contract sharing at the same address. In a case of netTcpRelayBindig this will not happen. So, the latter one can be started multiple timas at one box.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks to &lt;strong&gt;Tomislav Tipuric&lt;/strong&gt; director of WinDays technical track who has visionary recognized the industry need for this scenario.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=302562" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Core.Net/default.aspx">Core.Net</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/default.aspx">Architecture and Modeling</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/WCF/default.aspx">WCF</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Core.Net+WCF/default.aspx">Core.Net WCF</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category></item><item><title>Agenda for WinDays 2012 Session: Solution Architectures for Cloud, None-Cloud and Hybrid Applications Part II</title><link>http://developers.de/blogs/damir_dobric/archive/2012/04/22/agenda-for-windays-2012-session-solution-architectures-for-cloud-none-cloud-and-hybrid-applications-part-ii.aspx</link><pubDate>Sun, 22 Apr 2012 16:34:04 GMT</pubDate><guid isPermaLink="false">7e491611-45ad-4dae-a68f-c4cb64439510:295460</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=295460</wfw:commentRss><comments>http://developers.de/blogs/damir_dobric/archive/2012/04/22/agenda-for-windays-2012-session-solution-architectures-for-cloud-none-cloud-and-hybrid-applications-part-ii.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;WHEN: 25.04.2012.&amp;#160; 17:15 - 18:00h&amp;#160; &lt;br /&gt;WHERE: Rovinj -&amp;#160; HALL 4&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_260A4904.png"&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="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_54FC5F0E.png" width="721" height="491" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In this session you will learn about new possibilities around number of Windows Azure Services which provide new possibilities for applications running On-Premise, in the cloud or both. This demo-powered session will focus on powerful solution architecture patterns around&amp;#160; Relaying, Tunneling, brokering with Message Queue, Topics and more.    &lt;br /&gt;Note that this is not Windows Azure session only. It shows platform services and new possibilities which can be achieved.The session is designed for Windows and Windows Azure developers and architects, which need to build new kind of applications with new building blocks. Even more, we will also focus on development of applications which do not run in the cloud, but make usage of Windows Azure services.&lt;/p&gt;  &lt;p&gt;Focus of session are advanced solution architectures of hybrid and/or distributed applications which run on-premise in the cloud or both.   &lt;br /&gt;The coding related content is level 300 and architecture related topics might be higher like 400.&lt;/p&gt;  &lt;p&gt;On WinDays Portal:: &lt;a href="http://www.windays.hr/hr/raspored/technology/"&gt;http://www.windays.hr/hr/raspored/technology/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Follow: &lt;a href="http://twitter.com/#!/ddobric"&gt;http://twitter.com/#!/ddobric&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=295460" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/default.aspx">Architecture and Modeling</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category></item><item><title>Agenda for WinDays 2012 Session: Solution Architectures for Cloud, None-Cloud and Hybrid Applications Part I</title><link>http://developers.de/blogs/damir_dobric/archive/2012/04/21/agenda-for-windays-2012-session-solution-architectures-for-cloud-none-cloud-and-hybrid-applications.aspx</link><pubDate>Sat, 21 Apr 2012 17:57:50 GMT</pubDate><guid isPermaLink="false">7e491611-45ad-4dae-a68f-c4cb64439510:294622</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=294622</wfw:commentRss><comments>http://developers.de/blogs/damir_dobric/archive/2012/04/21/agenda-for-windays-2012-session-solution-architectures-for-cloud-none-cloud-and-hybrid-applications.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;WHEN: 25.04.2012. | 16:10 - 16:55h    &lt;br /&gt;WHERE: Rovinj - HALL 4&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_5A31467F.png"&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="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_12DBF08D.png" width="595" height="598" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this session you will start to talk about need for new platform service and cloud at all. The we will take a look on a number of new possibilities around Windows Azure Platform Services which provide new possibilities for applications running On-Premise, in the cloud or both.   &lt;br /&gt;&amp;#160; &lt;br /&gt;This demo-powered session will focus on new solution architectures based on componets like Caching, Storage and Access Control. We will see how these services work and how they can be used as components of modern applications.    &lt;br /&gt;&amp;#160; &lt;br /&gt;Focus of session are advanced solution architectures of hybrid distributed applications which run on-premise in the clod or both.    &lt;br /&gt;&amp;#160; &lt;br /&gt;Follow or recommend content on my blog:     &lt;br /&gt;http://developers.de/blogs/damir_dobric/archive/2012/04/21/agenda-for-windays-2012-session-solution-architectures-for-cloud-none-cloud-and-hybrid-applications.aspx&lt;/p&gt;  &lt;p&gt;On WinDays Portal:: &lt;a title="http://www.windays.hr/hr/raspored/technology/" href="http://www.windays.hr/hr/raspored/technology/"&gt;http://www.windays.hr/hr/raspored/technology/&lt;/a&gt;    &lt;br /&gt;    &lt;br /&gt;Follow: &lt;a title="https://twitter.com/#!/ddobric" href="https://twitter.com/#!/ddobric"&gt;http://twitter.com/#!/ddobric&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=294622" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/default.aspx">Architecture and Modeling</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category></item><item><title>Microsoft Network 2: Get Ready for Windows Azure</title><link>http://developers.de/blogs/damir_dobric/archive/2012/03/13/microsoft-network-2-get-ready-for-windows-azure.aspx</link><pubDate>Tue, 13 Mar 2012 22:11:17 GMT</pubDate><guid isPermaLink="false">7e491611-45ad-4dae-a68f-c4cb64439510:273071</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=273071</wfw:commentRss><comments>http://developers.de/blogs/damir_dobric/archive/2012/03/13/microsoft-network-2-get-ready-for-windows-azure.aspx#comments</comments><description>&lt;p&gt;   &lt;br /&gt;Announcing the &lt;a href="http://msnetwork.ba/novost/9609"&gt;session about Solution Architectures for Cloud&lt;/a&gt;, None-Cloud and hybrid applications. n this session you will learn about new possibilities around number of Windows Azure Services which provide new possibilities for applications running On-Premise, in the cloud or both. This demo-powered session will focus on powerful solution architecture patterns around Caching, Remoting, Tunneling, Relaying, brokering with Message Queue, Topics and more. The focus of session is not only development of Cloud applications. Even more, we will also focus on development of applications which do not run necessarily in the cloud, but make usage of Windows Azure services and related patterns.&lt;/p&gt;  &lt;p&gt;The session content targets every Windows and also none- Windows developers and architects who want to get ready for cloud.   &lt;br /&gt;Key messages:    &lt;br /&gt;    &lt;br /&gt;- Learn how to design On Premise, Cloud and Hybrid applications    &lt;br /&gt;- See how new communication styles can be applied to set right solution architecture for cloud, none-cloud and hybrid applications    &lt;br /&gt;-&amp;#160; Prepare to build On Premise applications today, which can run in Cloud tomorrow    &lt;br /&gt;    &lt;br /&gt;When: 05.04.2012 09.00 – 10.00h    &lt;br /&gt;&lt;a href="http://developers.de/media/p/273070/download.aspx"&gt;Add to your calendar.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msnetwork.ba/novost/9589"&gt;&lt;img src="http://msnetwork.ba/assets/images/network2head.png" width="261" height="79" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=273071" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Architecture+and+Modeling/default.aspx">Architecture and Modeling</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/WCF/default.aspx">WCF</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category></item></channel></rss>