<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>My Technobabble</title><link>http://blogs.msdn.com/b/gblock/</link><description>Glenn Block - .NETFX




Another ALT.NET guy at Microsoft</description><dc:language>en</dc:language><generator>Telligent Community 5.6.583.19849 (Build: 5.6.583.19849)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/MyTechnobabble" /><feedburner:info uri="mytechnobabble" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Integrating MVC routes and Web API routes</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/i8KVZuDoQp0/integrating-mvc-routes-and-web-api-routes.aspx</link><pubDate>Fri, 05 Aug 2011 05:57:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10193030</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10193030</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/08/05/integrating-mvc-routes-and-web-api-routes.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Several folks have been complaining for a while about Action Links not being properly generated when MVC routes are mixed with Service Routes in the same site.&lt;/p&gt;  &lt;p&gt;It turns out there is a solution.....don't use ServiceRoute :-) Instead, create a derived route below and use it. [Kudos to &lt;a href="http://www.haacked.com"&gt;Phil Haack&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/b/clemensv/"&gt;Clemens Vasters&lt;/a&gt; for this]&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; WebApiRoute : ServiceRoute
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; AppServiceRoute(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; routePrefix, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;       ServiceHostFactoryBase serviceHostFactory, Type serviceType)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     : &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;(routePrefix, serviceHostFactory, serviceType)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;      
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; VirtualPathData GetVirtualPath(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;       RequestContext requestContext, RouteValueDictionary values)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;       &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The link gen functionality uses the GetVirtualPath method to generate links. If you set it to null you are opting web api routes out of link gen and everything should work.&lt;/p&gt;

&lt;p&gt;Now to register your routes using this model, don't use MapServiceRoute.&lt;/p&gt;

&lt;p&gt;Instead, in add to your route table manually this way:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var config = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpHostConfiguration() &lt;span style="color: #808080"&gt;///create your config object&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var factory = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpConfigurableServiceHostFactory(config);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;routes.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebApiRoute(&amp;quot;&lt;span style="color: #8b0000"&gt;Foo&lt;/span&gt;&amp;quot;, factory, &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(Foo)));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;It's a little bit more code, but not too much and hey, it fixes the problem. This will be fixed in the next drop, which YES, we are working on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10193030" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=i8KVZuDoQp0:pHgIBYFvMMg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=i8KVZuDoQp0:pHgIBYFvMMg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=i8KVZuDoQp0:pHgIBYFvMMg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=i8KVZuDoQp0:pHgIBYFvMMg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=i8KVZuDoQp0:pHgIBYFvMMg:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=i8KVZuDoQp0:pHgIBYFvMMg:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=i8KVZuDoQp0:pHgIBYFvMMg:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/08/05/integrating-mvc-routes-and-web-api-routes.aspx</feedburner:origLink></item><item><title>REST In Practice the book, RestBucks the sample</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/Biow6O3QUQs/rest-in-practice-the-book-restbucks-the-sample.aspx</link><pubDate>Mon, 06 Jun 2011 20:11:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10171759</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10171759</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/06/06/rest-in-practice-the-book-restbucks-the-sample.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.amazon.com/gp/reader/0596805829/ref=sib_dp_pt#reader-link"&gt;&lt;img border="0" alt="REST in Practice: Hypermedia and Systems Architecture" src="http://ecx.images-amazon.com/images/I/51xSVWRSEFL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg" width="300" height="300" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h1&gt;The book&lt;/h1&gt;  &lt;p&gt;If you’ve watched any of my recent talks, one book you may have heard me mention quite a bit is &lt;a href="http://www.amazon.com/REST-Practice-Hypermedia-Systems-Architecture/dp/0596805829"&gt;“REST In Practice”&lt;/a&gt; by &lt;a href="http://twitter.com/#!/jimwebber"&gt;Jim Webber&lt;/a&gt;, &lt;a href="http://twitter.com/#!/savasp"&gt;Savas Parastatidas&lt;/a&gt; and &lt;a href="http://twitter.com/iansrobinson"&gt;Ian Robinson&lt;/a&gt;. The thing I really like about this book that differentiates it from others on &lt;a href="http://en.wikipedia.org/wiki/REST"&gt;REST&lt;/a&gt; is that it broaches the concept of REST in the enterprise. This book is essential for those building RESTful business systems. It’s a book that has helped my own understanding tremendously and one that I find practically by my bedside. It covers topics that are of concern for folks taking business systems and moving them to a RESTFul architecture style. It also gradually takes people across the chasm from traditional RPC style services, to HTTP CRUD services and then finally to RESTful services.&amp;#160; It is by no means the only book on the topic, as there are other good resources which I would also recommend like &lt;a href="http://twitter.com/subbu"&gt;Subbu’s&lt;/a&gt; work, &lt;a href="http://oreilly.com/catalog/9780596801694"&gt;RESTful Web Services Cookbook&lt;/a&gt;. &lt;/p&gt;  &lt;h1&gt;RestBucks, the sample&lt;/h1&gt;  &lt;p&gt;One of the cornerstones of the book is a reference application called &lt;a href="http://savas.me/blog/932"&gt;RestBucks&lt;/a&gt;, an application which takes the process of ordering coffee and exposes it electronically over HTTP using a set of RESTful services. The sample provides a great reference point for folks building RESTful systems to see how to address various concerns in a RESTful way. One key thing it addresses is the topic of hypermedia constraints / driving business processes through linking. Throughout the book we see various aspects of the sample implemented in various languages including Java and .NET. The .NET pieces utilize WCF 4. &lt;/p&gt;  &lt;h1&gt;Now available for WCF Web API thanks to the community&lt;/h1&gt;  &lt;p&gt;Since we announced WCF Web API, several folks have been asking for a port of RestBucks using our new web api. I actually started working on one, but due to other constraints never got around to making much progress. Fortunately folks from the community have stepped up to the plate! Several months back, Szymon Pobiega went and &lt;a href="http://site.restbucks.net/"&gt;ported&lt;/a&gt; the RestBucks code to use web api: &lt;a title="https://github.com/SzymonPobiega/restbucks-wcf" href="https://github.com/SzymonPobiega/restbucks-wcf"&gt;https://github.com/SzymonPobiega/restbucks-wcf&lt;/a&gt;. Checking the site, Szymon just recently updated the bits to Preview 4. &lt;/p&gt;  &lt;p&gt;More recently, &lt;a href="http://twitter.com/#!/jfroma"&gt;José Romaniello&lt;/a&gt; of Tellago &lt;a href="http://restbucks.codeplex.com/"&gt;released&lt;/a&gt; another port of RestBucks which he blogged about. One nice thing about this port is it includes documentation pages for the various links as well as some good content via his growing blog series which you can access here: &lt;a title="http://joseoncode.com/category/restbucks/" href="http://joseoncode.com/category/restbucks/"&gt;http://joseoncode.com/category/restbucks/&lt;/a&gt;. Jose and I have chatted and he is committed to really fleshing out the docs and keep the sample alive. Another cool thing is that José has deployed RestBucks on App Harbour so you can access it live here! &lt;a title="restbuckson.net" href="http://restbuckson.net/"&gt;restbuckson.net&lt;/a&gt;. Remember these are RESTful apis, not web pages. You’ll want to use something like Fiddler to navigate the app. If you want to get the source, you can download it at the codeplex site here: &lt;a title="http://restbucks.codeplex.com/" href="http://restbucks.codeplex.com/"&gt;http://restbucks.codeplex.com/&lt;/a&gt;. BTW, he’s looking for commtters &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-92-metablogapi/3652.wlEmoticon_2D00_winkingsmile_5F00_2.png" /&gt;&lt;/p&gt;  &lt;p&gt;Big thanks to Szymon and José for the port!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Get the book, get the samples!&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10171759" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Biow6O3QUQs:oEo4YM5Lh2w:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Biow6O3QUQs:oEo4YM5Lh2w:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=Biow6O3QUQs:oEo4YM5Lh2w:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Biow6O3QUQs:oEo4YM5Lh2w:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Biow6O3QUQs:oEo4YM5Lh2w:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Biow6O3QUQs:oEo4YM5Lh2w:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=Biow6O3QUQs:oEo4YM5Lh2w:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/06/06/rest-in-practice-the-book-restbucks-the-sample.aspx</feedburner:origLink></item><item><title>Message Handlers vs Operation Handlers which one to use?</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/pV5HoUbnTHk/message-handlers-vs-operation-handlers-which-one-to-use.aspx</link><pubDate>Tue, 17 May 2011 20:46:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10165550</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10165550</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/05/17/message-handlers-vs-operation-handlers-which-one-to-use.aspx#comments</comments><description>&lt;p&gt;In WCF Web API we have 2 extensibility points which seem very similar. They both are designed for very different reasons. Recently the question of which to use when &lt;a href="http://wcf.codeplex.com/discussions/257984"&gt;popped&lt;/a&gt; up on our forums. Below is some guidance.&lt;/p&gt;  &lt;h1&gt;Message Handlers&lt;/h1&gt;  &lt;p&gt;Message handlers (Currently DelegatingChannel but will be renamed to DelegatingHandler) only deal with http messages (hence the name), you can use them to modify the request or the response or to stop the request and immediately return a response. So in general you use message handlers for addressing http specific concerns, for example:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Logging each request (logging the uri) &lt;/li&gt;    &lt;li&gt;Checking for if-match / if-non-match headers and returning a 304 (not modified) &lt;/li&gt;    &lt;li&gt;Embedding an ETag header in the response &lt;/li&gt;    &lt;li&gt;Setting accept headers based on the uri (I do this in the ContactManager) &lt;/li&gt;    &lt;li&gt;Checking for API keys as in Pablo's (@cibrax) Handler &lt;a href="http://codepaste.net/b621hq"&gt;here&lt;/a&gt;, or handling other security concerns like OAuth. (Our OAuth integration in the future will sit here.) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;A few things to note about message handlers&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;They are configured per host not per operation &lt;/li&gt;    &lt;li&gt;They sit very low in the WCF stack in the channel layer making them ideal for security level concerns. &lt;/li&gt;    &lt;li&gt;They are arranged in a russian doll model meaning each handler calls to it's inner handler. This lets you do plug in pre-post handling before the handler is called. &lt;/li&gt;    &lt;li&gt;They only support async (Task&amp;lt;T&amp;gt;) &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Operation Handlers&lt;/h1&gt;  &lt;p&gt;Opeation handlers (HttpOperationHandler)&lt;strong&gt;&amp;#160;&lt;/strong&gt;deal with taking the message and manufacturing the parameters for an operation or vice versa. It is the responsibility of the operation handler pipeline to ensure that for every parameter in the method there is a corresponding value it is also the responsibility of the pipeline to take any return/out values and modify the message appopriately with the correct representation. Those values can either be pulled from the message itself (such as parsing the uri into an object) or from custom logic like talking to a respository. The exception here is the value that represents the content of the message. It is the responsibility of the &lt;strong&gt;Formatters &lt;/strong&gt;to handle taking the body and turning into an object or vice versa. Common use cases:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Taking a portion of the URI and manufacturing an object. An example of this would be taking a uri like &lt;a href="http://maps.com/location/100,00"&gt;http://maps.com/location/100,00&lt;/a&gt; and turning it into a Location object with latitude / longitude properties. &lt;/li&gt;    &lt;li&gt;Taking the content and compressing / decompressing it with gzip. Darrel Miller (@darrel_miller) has a nice example of this&lt;/li&gt;    &lt;li&gt;Logging specific parameters of an operation &lt;/li&gt;    &lt;li&gt;Validating the body, i.e. someone posts a customer in one of multiple formats. The formatter runs and turns it into a customer (based on conneg) and then the handler validates the model to see that the value are correct. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here's the things to note about operation handlers.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;They are configured per operaiton not per host &lt;/li&gt;    &lt;li&gt;Manufacture values which are used by other handlers in the pipeline or by the operation &lt;/li&gt;    &lt;li&gt;They are arranged in a pipeline where each handler is called in succession but one handler does not call the other. &lt;/li&gt;    &lt;li&gt;They only support sync in the box &lt;/li&gt;    &lt;li&gt;They can stop the pipeline by throwing an HttpResponseException&amp;lt;T&amp;gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Which to use really depends on your scenarios. If you are trying to address pure http concerns use message handlers, if you are trying to address application level concerns that work with models etc, use operation handlers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10165550" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=pV5HoUbnTHk:TaH-iZls0ME:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=pV5HoUbnTHk:TaH-iZls0ME:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=pV5HoUbnTHk:TaH-iZls0ME:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=pV5HoUbnTHk:TaH-iZls0ME:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=pV5HoUbnTHk:TaH-iZls0ME:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=pV5HoUbnTHk:TaH-iZls0ME:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=pV5HoUbnTHk:TaH-iZls0ME:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/HTTP/">HTTP</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/web+api/">web api</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/05/17/message-handlers-vs-operation-handlers-which-one-to-use.aspx</feedburner:origLink></item><item><title>Using DataContracts with WCF Web API</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/xwk_3qumvLU/using-datacontracts-with-wcf-web-api.aspx</link><pubDate>Sun, 15 May 2011 02:45:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10164562</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10164562</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/05/15/using-datacontracts-with-wcf-web-api.aspx#comments</comments><description>&lt;p&gt;A few folks have been &lt;a href="http://wcf.codeplex.com/discussions/248365"&gt;asking&lt;/a&gt; if it is possible to serialize/deserialize using the DataContractSerializer. Rest assured, yes it is possible. Now whether or not it is the easiest/most intuitive model well that it is a different question. &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-92-metablogapi/1440.wlEmoticon_2D00_winkingsmile_5F00_2.png" /&gt;&lt;/p&gt;  &lt;p&gt;If you read to the end the post you will see a bunch of extensions which have been pushed to webapicontrib and make this all MUCH easier (at least I think). If you don’t jump you’ll read below what you need to do if you do it yourself.&lt;/p&gt;  &lt;p&gt;It stars with the SetSerializer&amp;lt;T&amp;gt; method which is expose on the XmlMediaTypeFormatter. You can call this method and pass a DataContractSerializer for T. That tells the formatter use this serializer not the default. You need to give it the exact information, for example if you are returning List&amp;lt;Contact&amp;gt; then make T List&amp;lt;Contact&amp;gt; NOT T. If you want to support both, you need to register both.&lt;/p&gt;  &lt;p&gt;To allow you to get to the formatter, the MediaTypeFormatterCollection exposes an XmlFormatter property. You might now be thinking, “Oh that’s easy, but how do I get a hold of the formatter collection?”&lt;/p&gt;  &lt;p&gt;Good question. It depends on whether you are on the server or on the client.&lt;/p&gt;  &lt;h1&gt;On the Server&lt;/h1&gt;  &lt;p&gt;The easiest way to configure things on the server is to annotate your service/resource with a [DataContractFormat] attribute. Once you do then we will automatically use the DataContractSerializer. &lt;/p&gt;  &lt;p&gt;If you do not want to annotate your service, the alternative option is to do it in code. If you are using HttpHostConfiguration you can get to the formatters by accessing the OperationHandlerFactory property on the config class. If you are using the fluent API, you’ll want to cast to HttpHostConfiguration in order to access it. For example see the code below&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var config = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpHostConfiguration();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var formatter = OperationHandlerFactory.XmlFormatter;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;formatter.SetSerializer&amp;lt;Contact&amp;gt;(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContractSerializer(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(Contact)));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;formatter.SetSerializer&amp;lt;List&amp;lt;Contact&amp;gt;&amp;gt;(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContractSerializer(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(List&amp;lt;Contact&amp;gt;)));&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The code above is setting the formatter to use the DCS for Contact and List&amp;lt;Contact&amp;gt; both for reading and writing.&lt;/p&gt;

&lt;h1&gt;On the client&lt;/h1&gt;

&lt;p&gt;On the client side how you configure depends on if you are reading or writing. In either case both steps involve calling SetSerializer&amp;lt;T&amp;gt; on the XmlMediaTypeFormatter. &lt;/p&gt;

&lt;p&gt;For reading you will create the formatter and pass it to the ReadAs&amp;lt;T&amp;gt; method of the HttpContent which is accessed off of the Content property on HttpResponseMessage.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var formatter = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; XmlMediaTypeFormatter();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;formatter.SetSerializer&amp;lt;List&amp;lt;Contact&amp;gt;&amp;gt;&amp;gt;(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContractSerializer(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(List&amp;lt;Contact&amp;gt;))));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var contact = response.Content.ReadAs&amp;lt;T&amp;gt;(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;MediaTypeFormatter&amp;gt; { formatter });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;If you are writing to the request, you will access the formatters collection on the ObjectContent&amp;lt;T&amp;gt; instance.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var content = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ObjectContent&amp;lt;Contact&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;content.Formatters.SetSerializer&amp;lt;Contact&amp;gt;(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContractSerializer(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(Contact)));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;client.Post(content);&lt;/pre&gt;&lt;/pre&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;New extension methods in webapicontrib to make life easier&lt;/h1&gt;

&lt;p&gt;Now that we’ve seen how you can do it, we can wrap this up in a bunch of helper extension methods and life gets a whole lot easier. I did that and &lt;a href="http://webapicontrib.codeplex.com/SourceControl/changeset/view/2da8381982b9#source%2fFormatters%2fDataContractExtensions.cs"&gt;pushed&lt;/a&gt; them to webapicontrib &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-73-92-metablogapi/1440.wlEmoticon_2D00_winkingsmile_5F00_2.png" /&gt;&lt;/p&gt;

&lt;p&gt;Check the code below from the new DataContractExample in webapicontrib.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var config = HttpHostConfiguration.Create();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;font style="background-color: #ffff00"&gt;config.UseDataContractSerializer&amp;lt;Contact&amp;gt;();&lt;/font&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var host = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpConfigurableServiceHost&amp;lt;ContactsResource&amp;gt;(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  config, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(&amp;quot;&lt;span style="color: #8b0000"&gt;http://localhost:8080/&lt;/span&gt;&amp;quot;));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;host.Open();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var client = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpClient(&amp;quot;&lt;span style="color: #8b0000"&gt;http://localhost:8080/&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var newContact = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Contact {FirstName = &amp;quot;&lt;span style="color: #8b0000"&gt;Brad&lt;/span&gt;&amp;quot;, LastName = &amp;quot;&lt;span style="color: #8b0000"&gt;Abrams&lt;/span&gt;&amp;quot;};
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var content = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ObjectContent&amp;lt;Contact&amp;gt;(newContact,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &amp;quot;&lt;span style="color: #8b0000"&gt;application/xml&lt;/span&gt;&amp;quot;).&lt;font style="background-color: #ffff00"&gt;UseDataContractSerializer();&lt;/font&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var response = client.Post(&amp;quot;&lt;span style="color: #8b0000"&gt;contacts&lt;/span&gt;&amp;quot;, content);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;response = client.Get(&amp;quot;&lt;span style="color: #8b0000"&gt;contacts&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var contacts = response.Content.&lt;font style="background-color: #ffff00"&gt;ReadAsDataContract&amp;lt;Contact[]&amp;gt;();&lt;/font&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var contact &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; contacts)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  Console.WriteLine(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &amp;quot;&lt;span style="color: #8b0000"&gt;Contact: FirstName={0}, LastName={1}&lt;/span&gt;&amp;quot;, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    contact.FirstName, contact.LastName));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;Console.ReadLine();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;I’ve highlighted the important parts&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;UseDataContractSerializer&amp;lt;T&amp;gt; on the config will set the formatter to serialize T using DCS. In order to make life easier the extension method also registers for List&amp;lt;T&amp;gt; and T[]. &lt;/li&gt;

  &lt;li&gt;For reading on the client call the ReadAsDataContract&amp;lt;T&amp;gt; extension method on HttpContent. &lt;/li&gt;

  &lt;li&gt;For writing on the client create an ObjectContent&amp;lt;T&amp;gt; instance and call the UseDataContractSerializer() extension metho &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Download the bits in wcfwebapi contrib &lt;a href="http://webapicontrib.codeplex.com/SourceControl/list/changesets#"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10164562" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xwk_3qumvLU:-nExjiKUYzc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xwk_3qumvLU:-nExjiKUYzc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=xwk_3qumvLU:-nExjiKUYzc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xwk_3qumvLU:-nExjiKUYzc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xwk_3qumvLU:-nExjiKUYzc:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xwk_3qumvLU:-nExjiKUYzc:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=xwk_3qumvLU:-nExjiKUYzc:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/HTTP/">HTTP</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/05/15/using-datacontracts-with-wcf-web-api.aspx</feedburner:origLink></item><item><title>Hypermedia and forms</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/cpusGqI8xLs/hypermedia-and-forms.aspx</link><pubDate>Mon, 09 May 2011 00:45:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10162299</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10162299</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/05/09/hypermedia-and-forms.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;Updated (with a lot of new content)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;One challenge when building REST based systems is how can the client determine what it can do next? There can be any number of clients each which need to interact with a system. How do they know HOW to interact? The WSDL approach is to offer a static snapshot of method calls on an API. That approach couples the client heavily to knowing everything about the server, including being coupled as to how things get processed. It inhibits evolvability. A change to the server usually results in breaking all clients. In a world where there are many 3rd party apps across devices consuming your server application this can be detrimental making it extremely difficult to move forward.&lt;/p&gt;  &lt;h1&gt;Hypermedia&lt;/h1&gt;  &lt;p&gt;Hypermedia (also referred to as Hypertext) is an answer. The word may sound scary but it basically means use links. When &lt;a href="http://twitter.com/#!/timbernerslee"&gt;Tim Berners Lee&lt;/a&gt;, &lt;a href="http://twitter.com/#!/fielding"&gt;Roy Fielding&lt;/a&gt;, and others (Al Gore :-) ) were envisioning the Web, linking was a key component of that design. We’re used to seeing links in UI contexts like a browser, i.e. using a web based ordering system you can click on an “Add Item” link to add the item. But what about in a non-UI context? Well guess what, you can use links there as well. &lt;/p&gt;  &lt;p&gt;With a hypermedia approach your server doesn’t only return data. It returns data + links. Those links provide a means for the client to discover the available sets of options that make sense based on where the client is at in the application. A link has 2 standard components, a &lt;em&gt;url&lt;/em&gt; for the link and a &lt;em&gt;rel&lt;/em&gt;. REL in this case stands for relation and describes to the client how the link relates to the current resource. For example, let’s take a catalog / shopping cart experience exposed in a RESTful way. When browsing the catalog, you get back a&amp;#160; list of items. Each item can have links for adding the item to a cart. Below is one such item.&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;item&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;productNo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;1&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;itemNo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;An item&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;price&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;$19.95&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;price&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sku&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;123456789&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sku&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;link&lt;/span&gt; &lt;span style="color: #ff0000"&gt;rel&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;rc:additem&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;/cart/12456/items&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;item&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Above the server returned a&amp;#160; link for adding an item. Unlike an operation in a WSDL, that link it not static, and hardcoded as part of the contract. The server is offering the links that make sense at specific point in time based on the application and resource state. Assuming for example that “An Item” is out of stock, the client will not get a link for adding and item. Instead it may get a link to place the item on backorder. The client however doesn’t have any knowledge of the rules on the server. It doesn’t know that because the item is out of stock, it can’t add it. All it knows is that rel=”rc:additem” is not present. The server logic might be more sophisticated, maybe there are limits set on how much I can order of a specific item. From the client perspective though all it knows is the link is not present. That’s decoupling.&lt;/p&gt;

&lt;p&gt;What about evolvability? The beauty of linking is that clients only care about the links they know, they don’t care about the links they don’t. That means as the server evolves it can offer additional links. For example we may decide to offer clients the ability to put an item in a wish-list rather than in the shopping cart. That means an additional link is returned such as the following:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;link&lt;/span&gt; &lt;span style="color: #ff0000"&gt;rel&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;rc:addtowishlist&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;/wishlist/gblock&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Older clients won’t know about the wish list. They will however continue to function. Newer clients will&amp;#160; easily consume the new functionality. If you imagine a world with many different clients consuming (which is real), that is huge! There’s&amp;#160; a further benefit for the older clients. The server has advertised the fact that there are new capabilities. Clients can be designed to track links they don’t know such that they can log that there are new capabilities available.&lt;/p&gt;

&lt;p&gt;An additional benefit of the link approach has to do with the urls themselves. Clients are agnostic to&amp;#160; to building urls, thus the server can completely change the format of the url, or even where the urls point to without the client being impacted _at_all. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://twitter.com/#!/jon_moore"&gt;Jon Moore&lt;/a&gt;, a Technical Fellow at Comcast has a great talk / demonstration on how this works which he delivered at &lt;a href="http://oredev.org/2010/sessions/hypermedia-apis"&gt;Oredev&lt;/a&gt;. I highly recommend it.&lt;/p&gt;

&lt;h1&gt;What to with a link and why forms are interesting?&lt;/h1&gt;

&lt;p&gt;So now we have links. But there’s one problem, how does the client know what to do them?&amp;#160; Which HTTP method should be used, is it an HTTP GET, POST, etc? If it is a POST what type of content should be sent and in what form? Another challenge is around versioning, once a service has been updated, how do the clients know know how to upgrade that client to take advantage of the new functionality.&lt;/p&gt;

&lt;p&gt;One solution is simple, read the spec. When you build hypermedia based systems you aren’t simply returning a media type (Content-Type header value)&amp;#160; of “application/xml” or “application/json”. Rather you are returning something more specific such as “application/atom+xml” or something even more domain specific such as in tje new “&lt;a href="http://oreilly.com/catalog/9780596805838"&gt;REST in Practice book&lt;/a&gt;” where the system uses the media type of “application/vnd-restbucks+xml”. Each media type has an RFC/spec associated with it. Thus if a client author reads the spec, it should document what to expect from a links perspective and which method / media type to use.&lt;/p&gt;

&lt;p&gt;That is one approach and it &lt;strong&gt;absolutely&lt;/strong&gt; works. The downside of that approach is the client has to be encoded with specific knowledge of how to work with each link. &lt;/p&gt;

&lt;p&gt;That is not the only approach however and one really interesting one is Forms.&lt;/p&gt;

&lt;h1&gt;Forms&lt;/h1&gt;

&lt;p&gt;If we look to HTML we can see some hints on how to address these issues. In a web page, if you click a link such as “Add Item”, the common paradigm is for the server to return an HTML form (the client may also display one through some client script). That form provides information to the human who is reading the site to help them move forward. The Form contains an action that points to uri, and method, as well as other fields which may be either prefilled by the server, or require input from the user. The model works basically in a seem-less fashion. The site can freely evolve as it can offer different forms to different users based on a number of factors including what “version” of the app they are using, their user profile etc.&lt;/p&gt;

&lt;p&gt;Now imagine there is no human. There’s a machine client that is consuming some resources over HTTP. That machine may be jQuery code running in a browser, maybe be code executing in a rich client app such as WPF, Silverlight, Flash, or even a Java applet. Or it may be headless server code that is accessing that information. Ultimately the information will be likely surfaced to some human, but that is after some initial processing has taken place. For example there might be an agent that automatically processors orders using a 3rd party fulfillment service.&lt;/p&gt;

&lt;p&gt;We can design electronic forms which our servers offer to clients to guide them on how to use the link to transition to the next state.&lt;/p&gt;

&lt;p&gt;With this approach, each link is a GET that returns an electronic form. That form specifies url, method as well as pre-filled information from the server such as Item details. The form may also specify required fields such as a Quantity field.&lt;/p&gt;

&lt;p&gt;The advantage of forms is they allow the client to be less coupled to knowledge of how to work with links, which yields greater evolvability. &lt;/p&gt;

&lt;p&gt;For example for adding item '1'&amp;#160; to a shopping cart, the server may return the client a link such as the following.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;link&lt;/span&gt; &lt;span style="color: #ff0000"&gt;rel&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;rc:AddItem&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;/restcart/forms/additem/1&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The client then automatically does a GET on the link and retrieves an AddItem form that looks like the following.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;/restcart/cart/12456&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;method&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;POST&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;method&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;mediatype&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;vnd-restcart+xml&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;mediatype&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;item&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;productNo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;1&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;itemNo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;An item&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;price&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;$19.95&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;price&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sku&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;123456789&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sku&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;item&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;required&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;quantity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;1&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;quantity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;required&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;This form offers the client everything it needs to move forward. It does not have to build up the item information to POST as it has already been sent by the server. The server also specifies the media type for the client to use. This form additionally specifies that the client must provide a quantity.&lt;/p&gt;

&lt;p&gt;To move forward, the client will POST to the specified url using the included item as the body. As required fields are specified, the client must supply those as well.&lt;/p&gt;

&lt;p&gt;The server can also embed a token in the response in order to ensure the price of the item is valid for a period of time (say 2 hours). If there is no such guarantee or the time has expired, the server can return a status code of 409 (Conflict) to the client indicating that it needs to refresh the form.&lt;/p&gt;

&lt;p&gt;*Note: There are alternative approaches to exposing the cart as a resource, for example the CART state could be maintained on the client and sent with the POST. In either case it would not rely on session state.&lt;/p&gt;

&lt;h1&gt;Summary&lt;/h1&gt;

&lt;p&gt;Hypermedia allows clients and servers to independently evolve. In this approach the server offers clients well known links at every stage of the client/server interaction in order to to guide the client as to what they can do next.&lt;/p&gt;

&lt;p&gt;There are various approaches to implementing a hypermedia based system, including using electronic forms.&lt;/p&gt;

&lt;p&gt;You mileage may vary as to whether you need this or not.&lt;/p&gt;

&lt;p&gt;Interested in your thoughts.&lt;/p&gt;

&lt;h3&gt;Links&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Roy’s chapter on REST in his dissertation: &lt;a title="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm" href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm"&gt;http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Roy’s post on REST APIs and the need for hypertext - &lt;a title="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven" href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven"&gt;http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Jon Moore on “Hypermedia APIs” - &lt;a title="Hypermedia APIs" href="http://oredev.org/2010/sessions/hypermedia-apis"&gt;Hypermedia APIs&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;REST and Domain application protocols - &lt;a href="http://iansrobinson.com/2010/10/15/restful-domain-application-protocols/"&gt;http://iansrobinson.com/2010/10/15/restful-domain-application-protocols/&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Links and forms - &lt;a href="http://iansrobinson.com/2010/09/02/using-typed-links-to-forms/"&gt;http://iansrobinson.com/2010/09/02/using-typed-links-to-forms/&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;My hypermedia talk at Dev Days 2011 - &lt;a href="http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays017"&gt;http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays017&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10162299" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=cpusGqI8xLs:P7-eCNmFhEM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=cpusGqI8xLs:P7-eCNmFhEM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=cpusGqI8xLs:P7-eCNmFhEM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=cpusGqI8xLs:P7-eCNmFhEM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=cpusGqI8xLs:P7-eCNmFhEM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=cpusGqI8xLs:P7-eCNmFhEM:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=cpusGqI8xLs:P7-eCNmFhEM:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/hypermedia/">hypermedia</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/05/09/hypermedia-and-forms.aspx</feedburner:origLink></item><item><title>WebSockets, RIA/JS and WCF Web API at MIX, a whole lotta love for the web</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/zdjbK0lFWHo/websockets-ria-js-and-wcf-web-api-at-mix-a-whole-lotta-love-for-the-web.aspx</link><pubDate>Sun, 24 Apr 2011 09:52:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10157480</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10157480</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/04/24/websockets-ria-js-and-wcf-web-api-at-mix-a-whole-lotta-love-for-the-web.aspx#comments</comments><description>&lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2634/3867034897_32f913f353_z.jpg" /&gt;&lt;/p&gt;  &lt;p&gt;MIX was &lt;em&gt;indeed&lt;/em&gt; a busy time for the WCF Team. We delivered several talks, and released several shiny new toys to the community for folks that are building web-based systems.&lt;/p&gt;  &lt;h1&gt;WebSockets&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/craigkitterman"&gt;Craig Kitterman&lt;/a&gt; of our Interoperability group, and &lt;a href="http://twitter.com/#!/paulbatum"&gt;Paul Batum&lt;/a&gt;, whom you might &lt;a href="http://www.paulbatum.com/"&gt;know of&lt;/a&gt; from his work on Fluent NHibernate gave a talk: &lt;a href="http://channel9.msdn.com/events/mix/mix11/HTM10"&gt;Hot from the Labs: HTML5 WebSockets&lt;/a&gt;&lt;/p&gt;  &lt;div&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="512" height="288"&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="source" value="http://channel9.msdn.com/scripts/Channel9.xap?v=1.5" /&gt;&lt;param name="initParams" value="mediaurl=http://smooth.ch9.ms/ch9/DF00/3E505E08-3564-45A3-866D-9EB60082DF00/MIX11HTM10.ism/manifest,thumbnail=http://files.ch9.ms/mix/2011/thumbs/HTM10_lg.jpg,deliverymethod=adaptivestreaming,autoplay=false,entryid=3e505e08356445a3866d9eb60082df00" /&gt;&lt;/object&gt;&lt;/div&gt;  &lt;p&gt;In the talk they spoke about new explorations we are doing into supporting WebSockets in the Microsoft Stack. WebSockets is basically sockets for the web, i.e. a way to have a much more responsive in-browser experience. In the talk you’ll learn about the work going on in the W3C/IETF around WebSockets and you’ll see the exploratory work we’ve been doing both at the browser level and on the server to enable a WebSockets experience. I highly recommend this talk, as you’ll see is a pattern for the other talks I mention below.&lt;/p&gt;  &lt;p&gt;Here’s a sneak peak of what the coding experience looks like, which I hope you agree is pretty clean.&lt;/p&gt;  &lt;p&gt;On the client you have code such as the following:&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;conn.onopen = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  state.className = 'success';
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  state.innerHTML = 'Socket &lt;span style="color: #0000ff"&gt;open&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;};
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;conn.onmessage = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (event) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; message = JSON.parse(event.data);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; message == 'string') {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    log.innerHTML = '&amp;lt;li &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&amp;quot;&lt;span style="color: #8b0000"&gt;them&lt;/span&gt;&amp;quot;&amp;gt;' + 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    message.replace(/[&amp;lt;&amp;gt;&amp;amp;]/g, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (m) 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; entities[m]; }) + '&amp;lt;/li&amp;gt;' + log.innerHTML; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  } &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    connected.innerHTML = message;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;};
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;conn.onclose = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (event) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  state.className = 'fail';
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  state.innerHTML = 'Socket &lt;span style="color: #0000ff"&gt;closed&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;};&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The on the server you have a WebSocket service:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  ConcurrencyMode = ConcurrencyMode.Multiple)]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ChatService : WebSocketsService
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  ...
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnMessage(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    ChatService.sessions.RelayMessage(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; GetHashCode()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.id; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnClose(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    ChatService.sessions.Remove(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;h1&gt;&lt;font color="#333333" size="3" face="Segoe UI"&gt;You can download the latest bits of the WebSockets work at &lt;a href="http://html5labs.interoperabilitybridges.com/html5labs/prototypes/websockets/websockets/info/"&gt;the HTML 5 labs WebSockets page&lt;/a&gt;.&lt;/font&gt;&lt;/h1&gt;

&lt;h1&gt;RIA/JS&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://twitter.com/#!/brado_23"&gt;Brad Olenick&lt;/a&gt; of the RIA team delivered a talk: &lt;a title="Building Data-centric N-tier Applications with jQuery" href="http://channel9.msdn.com/events/MIX/MIX11/FRM05"&gt;Building Data-centric N-tier Applications with jQuery&lt;/a&gt;. &lt;/p&gt;

&lt;div&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="512" height="288"&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="source" value="http://channel9.msdn.com/scripts/Channel9.xap?v=1.5" /&gt;&lt;param name="initParams" value="mediaurl=http://files.ch9.ms/mix/2011/wmv/FRM05.wmv,thumbnail=http://files.ch9.ms/mix/2011/thumbs/FRM05_lg.jpg,deliverymethod=progressivedownload,autoplay=false,entryid=c41ecd9aa986486c99469eaf0092f8ee" /&gt;&lt;/object&gt;&lt;/div&gt;

&lt;p&gt;In the talk he unveiled new work the RIA team is doing is to allow consuming RIA services in jQuery! Watch the talk. Brad demonstrates how you can build a rich jQuery front end that dynamically pulls down all of it’s data to the client using RIA. RIA/JS then integrates all the state-tracking/validation richness and such using jQuery validators.&amp;#160; If you are building data-centric jQuery based applications then RIA can take care of a lot of the dirty work for you making your job easier*. This also highlights the value of RIA in that I can reuse my existing domain services now both across Silverlight and Javascript! I know my previous boss (who is deeply missed)&amp;#160; &lt;a href="http://bradabrams.com/2010/05/going-google/"&gt;Brad Abrams&lt;/a&gt; must be very happy seeing that this is being developed! &lt;/p&gt;

&lt;p&gt;*We’re not saying RIA/JS is the panacea for all evils, but it certainly is for some :-)&lt;/p&gt;

&lt;p&gt;Here are some of the key scenarios being supported in the first preview.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Query support with sorting, paging, filtering &lt;/li&gt;

  &lt;li&gt;Changeset submission with two edit modes: 
    &lt;ol&gt;
      &lt;li&gt;“Implicit Commit” or “write-thru edits” where updates to field values are automatically submitted to your DomainService. This can enable a Netflix.com or Mint.com experience where field changes are submitted to the server as soon as the user tabs out of the field. &lt;/li&gt;

      &lt;li&gt;“Buffered Changes” mode, where your code must call commitChanges() to submit your changeset to the DomainService. Those that have used the Silverlight client will be most familiar with this mode - a submit button is often used to trigger the commit. &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;

  &lt;li&gt;Data change events including collection changes &lt;/li&gt;

  &lt;li&gt;Client-side change tracking with an entity state API for determining what entities and properties have been edited &lt;/li&gt;

  &lt;li&gt;Entity data model support that allows you to navigate through associated entity properties and collections &lt;/li&gt;

  &lt;li&gt;Client-side validation by exposing your server-side validation metadata in jQuery validation format &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And here is a snippet of the new RIA/JS syntax. This is a great example of how we are looking to take advantage of awesome OSS solutions for delivering value. It’s about time!&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&amp;lt;script type=&amp;quot;&lt;span style="color: #8b0000"&gt;text/javascript&lt;/span&gt;&amp;quot;&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  $(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; serviceUrl = &amp;quot;&lt;span style="color: #8b0000"&gt;/CustomerApp-CustomerService.svc&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; customers = [];
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; render = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (loadedCustomers) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  $(&amp;quot;&lt;span style="color: #8b0000"&gt;#customerForm input[name='CustomerName']&lt;/span&gt;&amp;quot;).
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	    val(loadedCustomers[0].CustomerName);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  $(&amp;quot;&lt;span style="color: #8b0000"&gt;#customerForm&lt;/span&gt;&amp;quot;).link(loadedCustomers[0]);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	};
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	$([customers]).dataSource({
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  serviceUrl: serviceUrl,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  queryName: &amp;quot;&lt;span style="color: #8b0000"&gt;GetCustomers&lt;/span&gt;&amp;quot;,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	  refresh: render
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;	}).refresh();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&amp;lt;div id=&amp;quot;&lt;span style="color: #8b0000"&gt;customerForm&lt;/span&gt;&amp;quot;&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Name: &amp;lt;input type=&amp;quot;&lt;span style="color: #8b0000"&gt;text&lt;/span&gt;&amp;quot; &lt;span style="color: #0000ff"&gt;name&lt;/span&gt;=&amp;quot;&lt;span style="color: #8b0000"&gt;CustomerName&lt;/span&gt;&amp;quot; /&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;After the talk, the RIA team shipped new bits (as in js files) to Codeplex and a new &lt;a href="http://nuget.org/list/packages/RIAServices.jQuery"&gt;RIA Service jQuery Nuget&lt;/a&gt; package! allowing you to start to play with the RIA/JS stuff now.&amp;#160; Go get-em &lt;a href="http://bit.ly/wcfjquery"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;WCF Web API and Preview 4&lt;/h1&gt;

&lt;p&gt;Continuing along the path web goodness, I delivered a talk: &lt;a href="http://channel9.msdn.com/Events/MIX/MIX11/FRM14"&gt;WCF Web APIs: There’s a URI for that&lt;/a&gt;. &lt;/p&gt;

&lt;div&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="512" height="288"&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="source" value="http://channel9.msdn.com/scripts/Channel9.xap?v=1.5" /&gt;&lt;param name="initParams" value="mediaurl=http://files.ch9.ms/mix/2011/wmv-hq/FRM14-HD.wmv,thumbnail=http://files.ch9.ms/mix/2011/thumbs/FRM14_lg.jpg,deliverymethod=progressivedownload,autoplay=false,entryid=2aeb0e9aabff4e7da5be9eaf0092fab8" /&gt;&lt;/object&gt;&lt;/div&gt;

&lt;p&gt;In the talk I covered the evolution of systems that are now making their capabilities directly available over HTTP including social sites and line of business / enterprise apps. I showed progress we’ve made since PDC on our new WCF addition. The advances have been significant including greatly improving the out of the box experience, enhancing the fidelity you can have when working with HTTP,&amp;#160; improving the configuration story and improving testability. &lt;/p&gt;

&lt;p&gt;For example I demonstrated how using our new nuget package, you&amp;#160; quickly you can build a simple service that can return and consume xml, json as well as consume form url encoding content. I then throw an existing jQuery front end on top without having to touch the server side configuration. I then demonstrated how I could easily take my existing service and quickly refactor it to use an IoC container, in this case Autofac, by taking advantage of a new fluent api (which is still a work in progress).&lt;/p&gt;

&lt;p&gt;In the second part of my talk, I demonstrated how having rich control of formats/media types can benefit you. This includes showing my resource returning OData, as well a vcard implementation which I use to import contacts directly into gmail. Try that with SOAP, or plain-old XML/JSON, I dare you!&lt;/p&gt;

&lt;p&gt;Here’s a snippet of some of the HTTP fidelity I am talking about. Below my service takes advantage of our new HttpResponseMessage&amp;lt;T&amp;gt; and HttpResponseException to return a model AND work with HTTP at the same time. &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[WebGet(UriTemplate = &amp;quot;&lt;span style="color: #8b0000"&gt;{id}&lt;/span&gt;&amp;quot;)]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; HttpResponseMessage&amp;lt;Contact&amp;gt; Get(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; id)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  var contact = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.repository.Get(id);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contact == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var response = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpResponseMessage();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    response.StatusCode = HttpStatusCode.NotFound;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    response.Content = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StringContent(&amp;quot;&lt;span style="color: #8b0000"&gt;Contact not found&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpResponseException(response);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   var contactResponse = 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpResponseMessage&amp;lt;Contact&amp;gt;(contact);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   &lt;span style="color: #008000"&gt;//set it to expire in 5 minutes&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   contactResponse.Content.Headers.Expires = 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DateTimeOffset(DateTime.Now.AddSeconds(30));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; contactResponse;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The Get method returns a contact and sets caching headers. If the contact is not found however it throws an HttpResponseException passing in an HttpResponseMessage. In this case I am just returning a string, but you have full access to set the response headers/content to whatever you want. Also you might not have caught it, but the id parameter is now passed in as integer. In previous drops as well as in WCF HTTP you had to use a string. Well now we do automatic type conversion. You asked for it, and you got it!&lt;/p&gt;

&lt;h1&gt;Nuget and Preview 4&lt;/h1&gt;

&lt;p&gt;After my talk, I am happy to announce that we pushed our next release of WCF Web API (yes drop the s) to &lt;a href="http://wcf.codeplex.com/releases/view/64449"&gt;Codeplex&lt;/a&gt; along with a new set of &lt;a href="http://nuget.org/List/Search?packageType=Packages&amp;amp;searchCategory=All+Categories&amp;amp;searchTerm=webapi+httpclient+jsonvalue&amp;amp;sortOrder=package-download-count&amp;amp;pageSize=10"&gt;Nuget packages&lt;/a&gt; (webapi.all will get all of ours). You’ll notice a 6th package, &lt;a href="http://nuget.org/List/Packages/WebApi.CrudHttpSample"&gt;WebApi.CrudHttpSample&lt;/a&gt; from &lt;a href="http://geekswithblogs.net/michelotti/Default.aspx"&gt;Steve Michelotti&lt;/a&gt;. Rock on Steve! Here’s a &lt;a href="http://geekswithblogs.net/michelotti/archive/2011/04/21/wcf-web-api-is-pure-simplicity-with-nuget.aspx"&gt;link&lt;/a&gt; to more on that package.&lt;/p&gt;

&lt;p&gt;Preview 4 is &lt;em&gt;&lt;u&gt;loaded &lt;/u&gt;&lt;/em&gt;with new features much of which is based on your feedback! We’ve been developing them for a while and finally are able to get them out there. All of our apis have been significantly evolved in this release.&lt;/p&gt;

&lt;p&gt;Here is a summary of the major things you will find:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;New message classes HttpResponseMessage&amp;lt;T&amp;gt; / HttpRequestMessage&amp;lt;T&amp;gt; allows accessing headers and using a strongly typed model.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Uri parameters can now autocast to primtiive types, i.e. a uri template of &amp;quot;{id}&amp;quot; can map to an integer parameter of id.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Matching of parameters is now by type if there is no match on name, ie. HttpRequestMessage req will work.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;New Operation Handlers which replace processors and dramatically improve the authoring&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;New Formatters for plugging in custom media types&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;New Message Handlers for low level control over HTTP&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Newer HttpClient&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Support for Form Url Encoding / Json and Xml out of the box.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Support for HTTPs&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;IQueryable support with IQueryable&amp;lt;T&amp;gt; and without requiring attributes&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Overhauled&lt;strong&gt; fluent API for configuration !!!!&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;Unit tests&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;New samples&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;ContactManager is now a fully client based AJAX / JQuery application&lt;/p&gt;
  &lt;/li&gt;

  &lt;/ul&gt;&lt;ul&gt;
    &lt;li&gt;
      &lt;p&gt;New ContactManager_Simple illustrates the bare basics.&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ul&gt;

  &lt;ul&gt;&lt;li&gt;
    &lt;p&gt;new HelloResource sample&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Acceptance and Unit tests for some of the samples &lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am planning to do some follow up posting detailing all these changes, but this should be enough to keep you guys happy for a while &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8304.wlEmoticon_2D00_smile_5F00_2.png" /&gt;&lt;/p&gt;

&lt;p&gt;Go road test this stuff and give us your feedback. &lt;strong&gt;We want it&lt;/strong&gt;, we’re not done yet! &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10157480" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zdjbK0lFWHo:uTOBDyZnKTM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zdjbK0lFWHo:uTOBDyZnKTM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=zdjbK0lFWHo:uTOBDyZnKTM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zdjbK0lFWHo:uTOBDyZnKTM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zdjbK0lFWHo:uTOBDyZnKTM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zdjbK0lFWHo:uTOBDyZnKTM:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=zdjbK0lFWHo:uTOBDyZnKTM:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/RIA/">RIA</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/Mix/">Mix</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/HTTP/">HTTP</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WebSockets/">WebSockets</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/web+api/">web api</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/04/24/websockets-ria-js-and-wcf-web-api-at-mix-a-whole-lotta-love-for-the-web.aspx</feedburner:origLink></item><item><title>Adding vcard support and bookmarked URIs for specific representations with WCF Web Apis</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/gSa_4iDf7Tw/adding-vcard-support-and-bookmarked-uris-for-specific-representations-with-wcf-web-apis.aspx</link><pubDate>Mon, 07 Mar 2011 14:51:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10137666</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10137666</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/03/07/adding-vcard-support-and-bookmarked-uris-for-specific-representations-with-wcf-web-apis.aspx#comments</comments><description>&lt;p&gt;REST is primarily about 2 things, Resources and Representations. If you’ve seen any of my recent talks you’ve probably seen me open Fiddler and how our ContactManager sample supports multiple representations including Form Url Encoded, Xml, Json and yes an Image. I use the image example continually not necessarily because it is exactly what you would do in the real world, but instead to drive home the point that a representation can be anything. Http Resources / services can return anything and are not limited to xml, json or even html though those are the most common media type formats many people are used to.&lt;/p&gt;  &lt;p&gt;One advantage of this is your applications can return domain specific representations that domain specific clients (not browsers) can understand. What do I mean? Let’s take the ContactManager as an example. The domain here is contact management. Now there are applications like Outlook, ACT, etc that actually manage contacts. Wouldn’t it be nice if I could point my desktop contact manager application at my contact resources and actually integrate the two allowing me to import in contacts? Turns out this is where media types come to the rescue. There actually is a format called &lt;a href="http://en.wikipedia.org/wiki/VCard"&gt;vcard&lt;/a&gt; that encapsulates the semantics for specifying an electronic business card which includes contact information. &lt;a href="http://tools.ietf.org/html/rfc2425"&gt;rfc2425&lt;/a&gt; then defines a “text/directory” media type which clients can use to transfer vcards over HTTP.&lt;/p&gt;  &lt;p&gt;A sample of how a vcard looks is below (taken form the rfc)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;begin:VCARD      &lt;br /&gt;source:ldap://cn=bjorn%20Jensen, o=university%20of%20Michigan, c=US       &lt;br /&gt;name:Bjorn Jensen       &lt;br /&gt;fn:Bj=F8rn Jensen       &lt;br /&gt;n:Jensen;Bj=F8rn       &lt;br /&gt;email;type=internet:bjorn@umich.edu       &lt;br /&gt;tel;type=work,voice,msg:+1 313 747-4454       &lt;br /&gt;key;type=x509;encoding=B:dGhpcyBjb3VsZCBiZSAKbXkgY2VydGlmaWNhdGUK       &lt;br /&gt;end:VCARD&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Notice, it is not xml, not json and not an image :-) It is an arbitrary format thus driving the point I was making about the flexibility of HTTP. &lt;/p&gt;  &lt;h1&gt;Creating a vcard processor&lt;/h1&gt;  &lt;p&gt;So putting two and two together that means if we create a vcard processor for our ContactManager that supports “text/directory” then Outlook can import contacts from the ContactManager right? &lt;/p&gt;  &lt;p&gt;OK, here is the processor for VCARD.&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; VCardProcessor : MediaTypeProcessor
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; VCardProcessor(HttpOperationDescription operation)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        :&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;(operation, MediaTypeProcessorMode.Response)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; SupportedMediaTypes
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            yield &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &amp;quot;&lt;span style="color: #8b0000"&gt;text/directory&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; WriteToStream(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; instance, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;      Strea stream, HttpRequestMessage request)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var contact = instance &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; Contact;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contact != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            var writer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StreamWriter(stream);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            writer.WriteLine(&amp;quot;&lt;span style="color: #8b0000"&gt;BEGIN:VCARD&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            writer.WriteLine(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                &amp;quot;&lt;span style="color: #8b0000"&gt;FN:{0}&lt;/span&gt;&amp;quot;, contact.Name));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            writer.WriteLine(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 &amp;quot;&lt;span style="color: #8b0000"&gt;ADR;TYPE=HOME;{0};{1};{2}&lt;/span&gt;&amp;quot;, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 contact.Address, contact.City, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 contact.Zip));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            writer.WriteLine(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 &amp;quot;&lt;span style="color: #8b0000"&gt;EMAIL;TYPE=PREF,INTERNET:{0}&lt;/span&gt;&amp;quot;, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                 contact.Email));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            writer.WriteLine(&amp;quot;&lt;span style="color: #8b0000"&gt;END:VCARD&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            writer.Flush();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; ReadFromStream(Stream stream, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        HttpRequestMessage request)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NotImplementedException();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The processor above does not supporting posting vcard, but it actually could.&lt;/p&gt;

&lt;p&gt;Right. However there is one caveat, Outlook won’t send Accept headers &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0045.wlEmoticon_2D00_winkingsmile_5F00_1729B2BE.png" /&gt;, all it has a “File-Open” dialog.&amp;#160; There is hope though. It turns out that the dialog supports uris, thus as long as I can give it uri which is a bookmark to a vcard representation we’re golden. &lt;/p&gt;

&lt;p&gt;This is where in the past it gets a bit hairy with WCF. Today to do this means I need to ensure that my UriTemplate has a variable i.e. {id} is fine, but then I have to parse that ID to pull out the extension. It’s ugly code point blank. Jon Galloway expressed his distaste for this approach (which I suggested as a shortcut) in his post &lt;a href="http://weblogs.asp.net/jgalloway/archive/2010/12/01/wcf-mediatypeprocessor-speech-api-speechprocessor-fun.aspx"&gt;here&lt;/a&gt; (see the section Un-bonus: anticlimactic filename extension filtering epilogue).&lt;/p&gt;

&lt;p&gt;In that post, I showed parsing the ID inline. See the ugly code in bold?&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[WebGet(UriTemplate = &amp;quot;&lt;span style="color: #8b0000"&gt;{id}&lt;/span&gt;&amp;quot;)] 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Contact Get(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; id, HttpResponseMessage response) 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{ 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;strong&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; contactID = !id.Contains(&amp;quot;&lt;span style="color: #8b0000"&gt;.&lt;/span&gt;&amp;quot;)  
&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;strong&gt;        ? &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;.Parse(id, CultureInfo.InvariantCulture)  
&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;strong&gt;        : &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;.Parse(id.Substring(0, id.IndexOf(&amp;quot;&lt;span style="color: #8b0000"&gt;.&lt;/span&gt;&amp;quot;)), 
&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;strong&gt;        CultureInfo.InvariantCulture); 
&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var contact = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.repository.Get(contactID); 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contact == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    { 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        response.StatusCode = HttpStatusCode.NotFound; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        response.Content = HttpContent.Create(&amp;quot;&lt;span style="color: #8b0000"&gt;Contact not found&lt;/span&gt;&amp;quot;); 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    } 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; contact; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Actually that only solves part of the problem as I still need the Accept header to contain the media type or our content negotiation will never invoke the VCardProcessor!&lt;/p&gt;

&lt;h1&gt;Another processor to the rescue&lt;/h1&gt;

&lt;p&gt;Processors are one of the swiss army knives in our Web Api. We can use processors to do practically whatever we want to an HTTP request or response before it hits our operation. That means we can create a processor that automatically rips the extension out of the uri so that the operation doesn’t have to handle it as in above, and we can make it automatically set the accept header based on mapping the extension to the appropriate accept header.&lt;/p&gt;

&lt;p&gt;And here’s how it is done, enter UriExtensionProcessor.&lt;/p&gt;

&lt;pre&gt;&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; UriExtensionProcessor : 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   Processor&amp;lt;HttpRequestMessage, Uri&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IEnumerable&amp;lt;Tuple&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; extensionMappings;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; UriExtensionProcessor(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;      IEnumerable&amp;lt;Tuple&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; extensionMappings)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.extensionMappings = extensionMappings;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.OutArguments[0].Name = HttpPipelineFormatter.ArgumentUri;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; ProcessorResult&amp;lt;Uri&amp;gt; OnExecute(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;      HttpRequestMessage httpRequestMessage)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var requestUri = httpRequestMessage.RequestUri.OriginalString;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var extensionPosition = requestUri.IndexOf(&amp;quot;&lt;span style="color: #8b0000"&gt;.&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (extensionPosition &amp;gt; -1)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            var extension = requestUri.Substring(extensionPosition + 1);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            var query = httpRequestMessage.RequestUri.Query;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            requestUri = &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&amp;quot;&lt;span style="color: #8b0000"&gt;{0}?{1}&lt;/span&gt;&amp;quot;, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                requestUri.Substring(0, extensionPosition), query);;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            var mediaType = extensionMappings.Single(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                map =&amp;gt; extension.StartsWith(map.Item1)).Item2;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            var uri = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(requestUri);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            httpRequestMessage.Headers.Accept.Clear();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            httpRequestMessage.Headers.Accept.Add(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MediaTypeWithQualityHeaderValue(mediaType));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            var result = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ProcessorResult&amp;lt;Uri&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            result.Output = uri;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ProcessorResult&amp;lt;Uri&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Here is how it works (note how this is done will change in future bits but the concept/appoach will be the same). &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;First UrlExtensionProcessor takes a collection of Tuples with the first value being the extension and the second being the media type. &lt;/li&gt;

  &lt;li&gt;The output argument is set to the key “Uri”. This is because in the current bits the UriTemplateProcessor grabs the Uri to parse it. This processor will replace it. &lt;/li&gt;

  &lt;li&gt;In OnExecute the first thing we do is look to see if the uri contains a “.”. &lt;strong&gt;Note: This is a simplistic implementation which assumes the first “.” is the one that refers to the extension. A more robust implementation would look after the last uri segment at the first dot. I am lazy, sue me. &lt;/strong&gt;&lt;/li&gt;

  &lt;li&gt;Next strip the extension and create a new uri. Notice the query string is getting tacked back on. &lt;/li&gt;

  &lt;li&gt;Then do a match against the mappings passed in to see if there is an extension match. &lt;/li&gt;

  &lt;li&gt;If there is a match, set the accept header to use the associated media type for the extension. &lt;/li&gt;

  &lt;li&gt;Return the new uri. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With our new processors in place, we can now register them in the ContactManagerConfiguration class first for the request.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterRequestProcessorsForOperation(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   HttpOperationDescription operation, IList&amp;lt;Processor&amp;gt; processors,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   MediaTypeProcessorMode mode)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var map = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;Tuple&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    map.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Tuple&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;(&amp;quot;&lt;span style="color: #8b0000"&gt;vcf&lt;/span&gt;&amp;quot;, &amp;quot;&lt;span style="color: #8b0000"&gt;text/directory&lt;/span&gt;&amp;quot;));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    processors.Insert(0, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; UriExtensionProcessor(map));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Notice above that I am inserting the UriExtensionProcessor first. This is to ensure that the parsing happens BEFORE the UriTemplatePrcoessor executes.&lt;/p&gt;

&lt;p&gt;And then we can register the new VCardProcessor for the response.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterResponseProcessorsForOperation(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   HttpOperationDescription operation, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   IList&amp;lt;Processor&amp;gt; processors, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   MediaTypeProcessorMode mode)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PngProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;strong&gt;    processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; VCardProcessor(operation));
&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;h1&gt;Moment of truth – testing Outlook&lt;/h1&gt;

&lt;p&gt;Now with everything in place we “should” be able to import a contact into Outlook. First we have Outlook before the contact has been imported. I’ll use Jeff Handley as the guinea pig. Notice below when I search through my contacts he is NOT there.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6320.image_5F00_3D1F6314.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4452.image_5F00_thumb_5F00_2C57B866.png" width="438" height="261" /&gt;&lt;/a&gt; 

&lt;p&gt;Now after launching the ContactManager, I will go to the File-&amp;gt;Open-&amp;gt;Import dialog, and choose to import .vcf.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3113.image_5F00_4F580409.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4300.image_5F00_thumb_5F00_230B5758.png" width="440" height="262" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7345.image_5F00_4677D5F0.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8831.image_5F00_thumb_5F00_785F50AD.png" width="422" height="269" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click ok, and then refresh the search. Here is what we get.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6371.image_5F00_47D8A66A.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7853.image_5F00_thumb_5F00_39B9B76D.png" width="441" height="263" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;What we’ve learned&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Applying a RESTful style allows us evolve our application to support a new vcard representation. &lt;/li&gt;

  &lt;li&gt;Using representations allows us to integrate with a richer set of clients such as Outlook and ACT. &lt;/li&gt;

  &lt;li&gt;WCF Web APIs allows us to add support for new representations &lt;em&gt;without &lt;/em&gt;modifying the resource handler code (ContactResource) &lt;/li&gt;

  &lt;li&gt;We can use processors for a host of HTTP related concerns including mapping uri extensions as bookmarks to variant representations. &lt;/li&gt;

  &lt;li&gt;WCF Web APIs is pretty cool &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2260.wlEmoticon_2D00_smile_5F00_07FE9A18.png" /&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will post the code. For now you can copy paste the code and follow my direction using the ContactManager. It will work &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2260.wlEmoticon_2D00_smile_5F00_07FE9A18.png" /&gt;&lt;/p&gt;

&lt;h1&gt;&lt;strong&gt;What’s next.&lt;/strong&gt; &lt;/h1&gt;

&lt;p&gt;In the next post I will show you how to use processors to do a redirect or set the content-location header.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10137666" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=gSa_4iDf7Tw:3vIe_VhXdhw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=gSa_4iDf7Tw:3vIe_VhXdhw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=gSa_4iDf7Tw:3vIe_VhXdhw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=gSa_4iDf7Tw:3vIe_VhXdhw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=gSa_4iDf7Tw:3vIe_VhXdhw:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=gSa_4iDf7Tw:3vIe_VhXdhw:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=gSa_4iDf7Tw:3vIe_VhXdhw:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/03/07/adding-vcard-support-and-bookmarked-uris-for-specific-representations-with-wcf-web-apis.aspx</feedburner:origLink></item><item><title>WCF Web APIs Roundup–Volume 2</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/wdu5tN097GE/wcf-web-apis-roundup-volume-2.aspx</link><pubDate>Mon, 07 Mar 2011 00:37:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10137462</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10137462</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2011/03/07/wcf-web-apis-roundup-volume-2.aspx#comments</comments><description>&lt;p&gt;Been a while since our last roundup and since my last blog post for that matter! Fortunately there’s been a bunch of cool stuff going on in the community with our Web APIs that I can point you to. Great to see the community momentum pick up as we cross the 5000 download mark on &lt;a href="http://wcf.codeplex.com"&gt;Codeplex&lt;/a&gt;!&lt;/p&gt;  &lt;h1&gt;Blogs&lt;/h1&gt;  &lt;ul&gt;   &lt;ul&gt;&lt;!--EndFragment--&gt;&lt;/ul&gt;    &lt;li&gt;&lt;strong&gt;WCF Web API general&lt;/strong&gt;&lt;/li&gt;    &lt;/ul&gt;&lt;ul&gt;     &lt;li&gt;&lt;a href="http://wizardsofsmart.net/news/a-new-web-for-net-wcf-web-apis/"&gt;A new Web for .NET: WCF Web APIs&lt;/a&gt; – Ryan Riley talks about the new Web APIs and work he is doing in F# to offer a Sinatra like experience using them. &lt;/li&gt;      &lt;li&gt;&lt;a href="http://thegsharp.wordpress.com/2011/02/16/wcf-http-start-using-it/"&gt;WCF HTTP – Start Using It&lt;/a&gt; – Gustavo walks through the basics of setting up an HTTP Service and adding Media Type support.&lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;&lt;li&gt;&lt;strong&gt;HttpClient&lt;/strong&gt;&lt;/li&gt;    &lt;/ul&gt;&lt;ul&gt;     &lt;li&gt;&lt;a title="http://www.theleagueofpaul.com/url-shortening-with-wcf-web-api-httpclient" href="http://www.theleagueofpaul.com/url-shortening-with-wcf-web-api-httpclient"&gt;Url shortening with WCF Web Apis HttpClient&lt;/a&gt; - Paul Jenkins of &lt;a href="http://www.mahtweets.com/"&gt;MahTweets&lt;/a&gt; fame posts on using our new Http client API for calling a url shortening service &lt;/li&gt;      &lt;li&gt;&lt;a href="http://xamlcoder.com/blog/2011/01/23/consuming-wcf-web-rest-apis-in-silverlight/"&gt;Consuming WCF Web (REST) Apis in Silverlight&lt;/a&gt; – Joe Mcbride blogs about a new SimpleHttpClient he created for accessing WCF Web API services and other services. &lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;&lt;li&gt;&lt;strong&gt;Processors&lt;/strong&gt;&lt;/li&gt;    &lt;/ul&gt;&lt;ul&gt;     &lt;li&gt;&lt;a href="http://thegsharp.wordpress.com/2011/02/17/wcf-http-processors-under-the-hood/"&gt;WCF HTTP – Processors under the hood&lt;/a&gt; – Gustavo gives a deep overview of how processors work. He also shows how to build several processors including a processor that will convert uri parameters into native types.&lt;/li&gt;      &lt;li&gt;&lt;a href="http://wizardsofsmart.net/news/middleware-in-the-wcf-web-apis/"&gt;Middleware in the WCF Web APIs&lt;/a&gt; – Ryan posts on how you can use our new Processor api for plugging in Middleware like different view engines.&lt;/li&gt;      &lt;li&gt;&lt;a href="http://www.funnelweblog.com/extensions/wcf-http-extensions"&gt;Extensions – WCF HTTP Services&lt;/a&gt; – Funnel Web is an OSS blog &lt;a href="http://www.funnelweblog.com/"&gt;engine&lt;/a&gt;. This post shows you how you can plug in services which are hosted in FunnelWeb and which have DI support through Autofac via the new IoC extensions in Preview 3.&lt;/li&gt;      &lt;li&gt;&lt;a href="http://thegsharp.wordpress.com/2011/02/17/wcf-http-cool-processor-for-enabling-navigation/"&gt;WCF HTTP – Cool processor for Navigation&lt;/a&gt; – Gustavo shows us how a custom processor can simplify handling sub-resources.&lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/li&gt;    &lt;/ul&gt;&lt;ul&gt;     &lt;li&gt;&lt;a href="http://weblogs.asp.net/cibrax/archive/2011/02/04/authenticating-clients-in-the-new-wcf-http-stack.aspx"&gt;Authenticating clients in the WCF HTTP Stack&lt;/a&gt; – In this Pablo Cibraro introduces some extensions for WCF Web APIs based on previous interceptors he had for the REST Start Kit which are used for authenticating clients. He says he believes the new Web APIs offer much richer support for building HTTP oriented services in NET. We agree :-)&lt;/li&gt;      &lt;li&gt;&lt;a href="http://blog.alexonasp.net/post/2011/03/02/Using-WCF-Web-APIs-WCF-Http-with-ASPNET-Forms-Authentication.aspx"&gt;Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication&lt;/a&gt; – Alex Zeitler shows us how to use WCF Web APIs with ASP.NET forms authentication!&lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;&lt;li&gt;&lt;strong&gt;ASP.NET MVC&lt;/strong&gt;&lt;/li&gt;    &lt;/ul&gt;&lt;ul&gt;     &lt;li&gt;&lt;a href="http://pozitive.net/2011/02/11/json-asp-net-mvc-and-jquery-working-with-untyped-json-made-easy/"&gt;JSON, ASP.NET MVC and JQuery – Working with Untyped JSON made easy&lt;/a&gt; – Ana posts on how you can access untyped Json via a custom model binder in MVC which uses the new JsonValue that we ship in WCF Web APIs &lt;/li&gt; &lt;/ul&gt;&lt;!--EndFragment--&gt;   &lt;h1&gt;Podcasts / Videos&lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/Series/mvcConf/mvcConf-2-Glenn-Block-Take-some-REST-with-WCF"&gt;Take some REST with WCF&lt;/a&gt; – My talk at MVCConf on our new APIs including exposing OData, and usage with MVC.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/Shows/Endpoint/endpointtv-WCF-Web-API-Content-Types"&gt;endpoint.tv – WCF Web API – Content Types&lt;/a&gt; – Ron Jacobs and I look at the new media type support in WCF Web APIs which enables building great browser apps that use JQuery to talk to HTTP Services.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://jesseliberty.com/2011/02/22/yet-another-podcast-25glenn-block-wcf/"&gt;Yet Another Podcast #25-Glenn Block/WCF&lt;/a&gt; – Jesse Liberty and I kick it about HTTP, REST and the new Web APIs. That is after I finish interviewing him. :p&lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;WCF Web API team&lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://codebetter.com/howarddierking/2011/03/02/ive-moved-3/"&gt;I’ve moved&lt;/a&gt; – Howard Dierking (formerly of MSDN Magazine) announces that he has joined our team!&lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10137462" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=wdu5tN097GE:EMKCyQtQ9bw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=wdu5tN097GE:EMKCyQtQ9bw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=wdu5tN097GE:EMKCyQtQ9bw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=wdu5tN097GE:EMKCyQtQ9bw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=wdu5tN097GE:EMKCyQtQ9bw:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=wdu5tN097GE:EMKCyQtQ9bw:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=wdu5tN097GE:EMKCyQtQ9bw:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2011/03/07/wcf-web-apis-roundup-volume-2.aspx</feedburner:origLink></item><item><title>WCF Web APIs Roundup - Volume 1</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/qIAplCNGcWs/wcf-web-apis-roundup-volume-1.aspx</link><pubDate>Mon, 13 Dec 2010 06:31:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10103910</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10103910</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/12/13/wcf-web-apis-roundup-volume-1.aspx#comments</comments><description>&lt;p&gt;A little over a month ago we launched our new WCF Web Apis on &lt;a href="http://blogs.msdn.com/b/gblock/archive/2010/11/01/wcf-web-apis-http-your-way.aspx"&gt;Codeplex&lt;/a&gt;. Since then a bunch of folks in the community (and some internal folks) have been posting about their own explorations / thoughts of the new bits. it’s great to see the work that they are doing! I am going to start aggregating these and periodically (I am not committing to a cadence &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3060.wlEmoticon_2D00_winkingsmile_5F00_5BE0437D.png" /&gt; but am aiming for monthly) post pointers to whatever I find. Appreciate any suggestions to the format.&lt;/p&gt;  &lt;h1&gt;Blogs&lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;On WCF Web Apis      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://www.bizcoder.com/index.php/2010/10/28/wcf-http/"&gt;Microsoft WCF gets serious about HTTP&lt;/a&gt; – Darrel Miller shares his thoughts on the new WCF Web Apis, it’s importance, and how it compares aganst other offerings within the .NET stack. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://weblogs.asp.net/jgalloway/archive/2010/12/01/okay-wcf-we-can-be-friends-now.aspx"&gt;Okay, WCF we can be friends now&lt;/a&gt; – Jon Galloway gives an overview of the new features in WCF Web Apis including HTTP enhancements and jQuery support.. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://weblogs.asp.net/cibrax/archive/2010/11/01/new-iqueryable-support-for-http-services-in-wcf.aspx"&gt;New IQueryable Support for HTTP Services in WCF&lt;/a&gt; – Pablo Cibraro explores the new query composition feature we’re adding to enable LINQ to WCF type scenarios. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Using Processors      &lt;ul&gt;       &lt;li&gt;&lt;a href="http://weblogs.asp.net/cibrax/archive/2010/11/15/http-processors-in-the-wcf-web-programming-model.aspx"&gt;Http Processors in the new WCF Programming Model&lt;/a&gt; – Pablo describes the new processor api that we’ve introduced for addressing HTTP specific concerns in a cross-cutting fashion. He demonstrates how to use processors for transforming a portion of the URI into a CultureInfo object. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://weblogs.asp.net/cibrax/archive/2010/11/19/versioning-rest-services-with-wcf-http-processors.aspx"&gt;Versioning REST services with WCF HTTP Processors&lt;/a&gt; – Pablo describes an approach for versioning with media types. Processors are used to transform a portion of the media type into a version with the operation uses to returned a versioned response. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://geekswithblogs.net/michelotti/archive/2010/11/17/combine-wcf-mediatypeprocessors-with-a-custom-razor-host.aspx"&gt;Combine WCF MedaTypeProcessors with a Custom Razor Host&lt;/a&gt; – Steve Michelotti describes how you can create a processor which uses the new ASP.NET Razor engine to render an HTML response. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://weblogs.asp.net/jgalloway/archive/2010/12/01/wcf-mediatypeprocessor-speech-api-speechprocessor-fun.aspx"&gt;WCF Media Processor + Speech API = SpeechProcessor fun&lt;/a&gt; – Jon Galloway illustrates how to plug in a custom processor for rendering a representation using the .NET Speech API. Using the processor allows one to use the new HTML 5 Audio tag or to point windows media player at a resource and have it literally &amp;quot;say” the response. Jon also does a great overview of how MediaTypeProcessors work and the value of supporting multiple formats. &lt;/li&gt;        &lt;li&gt;&lt;a href="http://weblogs.thinktecture.com/cweyer/2010/12/using-jsonnet-as-a-default-serializer-in-wcf-httpwebrest-vnext.html"&gt;Using JSON.NET as a default serializer in WCF HTTP/Web/REST (vNext)&lt;/a&gt; – Christian Weyer shows how to replace the default JSON serializer in WCF Web APIs with a custom serializer that uses the popular &lt;a href="http://json.codeplex.com/"&gt;Json.NET&lt;/a&gt; library. In addition to supporting JSON,he also shows how to support BSON (binary JSON) &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Other cool things to note&lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://wcfhttpcontrib.codeplex.com/"&gt;WCF Http Contrib&lt;/a&gt; –&amp;#160; A new codeplex site for contributions to WCF Web Apis. &lt;/li&gt;    &lt;li&gt;WCF Web Apis are on &lt;a href="http://nuget.codeplex.com/"&gt;nuget&lt;/a&gt;! – If you want to quickly get going with using the new APIs in your projects, nuget is the answer! We’ve posted two nuget packages. Note: Run both packages from the nuget command shell as they execute powershell scripts for registering gaced WCF assemblies.&amp;#160; &lt;ul&gt;       &lt;li&gt;WcfWebApis – This package contains binaries for WcfWebApis. Installing it will add appropriate project references for WCF and the new apis and will update the web.config. &lt;/li&gt;        &lt;li&gt;WcfResource – This package depends on WcfWebApis and contains the convention based resource model prototype I &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2010/11/15/exploring-resources-a-resource-programming-model-and-code-based-configuration.aspx"&gt;blogged&lt;/a&gt; about recently. The model supports conventions, code-based configuration and provides hooks for using an IoC containers. &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10103910" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=qIAplCNGcWs:VFXQUiWBVGk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=qIAplCNGcWs:VFXQUiWBVGk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=qIAplCNGcWs:VFXQUiWBVGk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=qIAplCNGcWs:VFXQUiWBVGk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=qIAplCNGcWs:VFXQUiWBVGk:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=qIAplCNGcWs:VFXQUiWBVGk:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=qIAplCNGcWs:VFXQUiWBVGk:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/12/13/wcf-web-apis-roundup-volume-1.aspx</feedburner:origLink></item><item><title>Streaming over HTTP with WCF</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/7pOlWOv0HfM/streaming-over-http-with-wcf.aspx</link><pubDate>Wed, 24 Nov 2010 23:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10096305</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>6</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10096305</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/11/24/streaming-over-http-with-wcf.aspx#comments</comments><description>&lt;p&gt;Recently I had a customer email me looking for information on how to send and receive large files with a WCF HTTP service. WCF supports streaming specifically for these types of scenarios.&amp;#160; Basically with streaming support you can create a service operation which receives a stream as it’s incoming parameter and returns a stream as it’s return value (a few other types like Message and anything implementing IXmlSerializable are also supported). MSDN describes how streaming in WCF works &lt;a href="http://msdn.microsoft.com/en-us/library/ms733742.aspx"&gt;here&lt;/a&gt;, and how to implement it &lt;a href="http://msdn.microsoft.com/en-us/library/ms789010.aspx"&gt;here&lt;/a&gt;. There’s a few gotchas however if you are dealing with sending large content with a service that is hosted in ASP.NET. If you scour the web you can find the answers, such as in the comments &lt;a href="http://www.haveyougotwoods.com/archive/2008/04/14/wcf-message-streaming.aspx"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;In this post I’ll bring everything together and walk you through building a service exposed over HTTP and which uses WCF streaming. I’ll also touch on supporting file uploads with ASP.NET MVC, something I am sure many are familiar with. The &lt;a href="http://cid-f8b2fd72406fb218.office.live.com/self.aspx/blog/DocumentStore.zip"&gt;sample&lt;/a&gt; which we will discuss requires .NET 4.0 and &lt;a href="http://www.asp.net/mvc/mvc3"&gt;ASP.NET MVC 3 RC&lt;/a&gt;. If you don’t have MVC you can skip right to the section “Enabling streaming in WCF”. Also it’s very easy to adopt the code to work for web forms.&lt;/p&gt;  &lt;h1&gt;The scenario&lt;/h1&gt;  &lt;p&gt;For the sample we’re going to use a document store. To keep things simple and stay focused on the streaming, the store allows you to do two things, post documents and retrieve them through over HTTP. Exposing over HTTP means I can use multiple clients/devices to talk to the repo.&amp;#160; Here are more detailed requirements.&lt;/p&gt;  &lt;p&gt;1. A user can POST documents to the repository with the uri indicating the location where the document will be stored using the uri format “http://localhost:8000/documents/{file}”. File in this case can include folder information, for example the following is a valid uri, “http://localhost:8000/documents/pictures/lighthouse.jpg”. &lt;/p&gt;  &lt;p&gt;Below is what the full request looks like in Fiddler. Note: You’ll notice that the uri (and several below) has a “.” in it after localhost, this is a trick to get Fiddler to pick up the request as I am running in Cassini (Visual Studio’s web server). &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6661.image_5F00_6739EA22.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6406.image_5F00_thumb_5F00_26979DB3.png" width="496" height="186" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And the response&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6180.image_5F00_262B6ABE.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3463.image_5F00_thumb_5F00_2CDE7441.png" width="499" height="136" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;2. On a POST, the server creates the necessary folder structure to support the POST. This means if the Pictures sub-folder does not exist it will get created.&lt;/p&gt;  &lt;p&gt;3. A user can GET a document from the repository using the same uri format for the POST. Below is the request for retrieving the document we just posted. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6661.image_5F00_65891E4E.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0211.image_5F00_thumb_5F00_3E4ED519.png" width="505" height="119" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And the response: (To keep thing simple I am not wrestling with setting the appropriate content type thus application/octet-stream is the default).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8637.image_5F00_04CBC522.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2867.image_5F00_thumb_5F00_5D917BEC.png" width="505" height="173" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. The last requirement was I needed a simple front end for uploading the file.&amp;#160; For this I decided to use ASP.NET MVC3 to create a really simple front end. That also gave me a chance to dip my feet in the new Razor syntax.&lt;/p&gt;  &lt;h1&gt;Creating the application&lt;/h1&gt;  &lt;p&gt;The first thing I did was create a new MVC 3 application in Visual Studio. I called the application “DocumentStore” and selected to create an empty application when prompted.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1616.image_5F00_5D2548F7.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/5187.image_5F00_thumb_5F00_03872C43.png" width="622" height="432" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next thing I did was was add a HomeController and a new view Index.cshtml which I put in the Views/Home folder. The view which is below allows me to upload a document and specify the folder. I did tell you it was simple right? &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7144.wlEmoticon_2D00_smile_5F00_545540AB.png" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6165.image_5F00_1014D95F.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8228.image_5F00_thumb_5F00_6F8D99AC.png" width="644" height="207" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next I added an Upload view also in the View/Home folder. That view show she result of the upload. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3022.image_5F00_71E71BAA.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0702.image_5F00_thumb_5F00_31B10230.png" width="404" height="124" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Then in the HomeController I implemented the Upload action which contains the logic for POSTing to the service. I used HttpClient form the Rest Starter Kit to do the actual post.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6406.image_5F00_77C1BF43.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/5008.image_5F00_thumb_5F00_5CA8F035.png" width="748" height="330" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Here’s the flow&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Grab the uploaded file and the path. &lt;/li&gt;    &lt;li&gt;Create the uri for the resource I am going to post. &lt;/li&gt;    &lt;li&gt;Post the resource using HttpClient. &lt;/li&gt;    &lt;li&gt;Set the filename info to return in the view. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Up until this point I’ve simply created the front end for uploading the document. Now we can get to the streaming part. &lt;/p&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h1&gt;Enabling streaming over HTTP&lt;/h1&gt;  &lt;p&gt;Streaming is enabled in WCF through the transferMode property on the binding. In this case I set transferMode to “Streamed” as I want to support it bi-directionally. The setting accepts other values which can be used to enable streaming on the request OR the response. I also set the maxReceivedMessageSize to the maximum size that I want to allow for transfers. Finally I also also set the maxBufferSize, though this is not required. WCF 4.0 introduced default bindings which greatly simplifies this configuration. In this case because I’m going to use WCF HTTP, I can use the standard webHttpBinding as is shown.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3438.image_5F00_0CEFC4EC.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0218.image_5F00_thumb_5F00_0C8391F7.png" width="595" height="179" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you read the MSDN articles I cited above, you might think I’m done, however because I’m hosting our service on ASP.NET, there’s one more critical setting I need to mess with. This one definitely threw me for a loop. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7635.image_5F00_39987EC5.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2451.image_5F00_thumb_5F00_274FB803.png" width="496" height="49" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;ASP.NET doesn’t know about WCF and it has it’s own limits for the request size which I have now increased to match my limit. Without setting this the request will be killed if it exceeds the limits. This setting and the previous settings &lt;strong&gt;have&lt;/strong&gt; to be kept in sync. If not, either ASP.NET will kill the request, or WCF will return a Status 400: Invalid Request. &lt;a href="http://msdn.microsoft.com/en-us/library/aa702726.aspx"&gt;Service tracing&lt;/a&gt; is definitely your friend in figuring out any issues on the WCF side.&lt;/p&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h1&gt;Building the DocumentsResource&lt;/h1&gt;  &lt;p&gt;Now that streaming is enabled, I can build the resource. First I created a DocumentsResource class which I marked as a ServiceContract and configured to allow hosting in ASP.NET.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2364.image_5F00_4B08DF9D.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7635.image_5F00_thumb_5F00_7FA93BD8.png" width="762" height="80" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Registering the resource through routes (.NET 4.0 Goodness!)&lt;/h1&gt;  &lt;p&gt;Because I am using .NET 4.0, I can take advantage of the new ASP.NET routing integration to register my new resource without needing an .SVC file. To do this, I create a ServiceRoute in the Global.asax specifying the base uri and the service type (resource).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4405.image_5F00_5802BFAE.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3438.image_5F00_thumb_5F00_0921FA4F.png" width="774" height="213" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Document retrieval (GET)&lt;/h2&gt;  &lt;p&gt;Our document store has to allow retrieval of documents. Below is the implementation.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6746.image_5F00_487FADDF.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1781.image_5F00_thumb_5F00_4F32B762.png" width="665" height="255" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As I mentioned earlier, when you enable streaming your operations only work with a limited set of input / return values. In this case my GET method returns a stream which represents the document. Notice the method is has no parameters. When building a streamed service, the method can only have a single parameter which is either of type stream, message or which implements IXmlSerializable. This forces me to jump through a small hoop to get access to the path info for the document, but it’s manageable.&lt;/p&gt;  &lt;p&gt;Here’s the logic in the method.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The method is annotated with a WebGetAttribute to indicate that it is a GET. The UriTemplate is set to “*” in order to match against any uri that matches the base uri for this service.. &lt;/li&gt;    &lt;li&gt;Next I grab all the uri segments and concatenate in order to create the relative file location. For example for the uri “http://localhost:8080/documents/pictures/lighthouse.jpg” this will result in “pictures\lighthouse.jpg” assuming the base address is “documents'”. &lt;/li&gt;    &lt;li&gt;If a file path was actually passed in, I then create a the relative file path by concatenating the relative location with the server root and the relative path for the doc store. &lt;/li&gt;    &lt;li&gt;Finally I create a stream pointing to the file on disk and I return it. The resulting stream is then returned back to the client. &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Document upload (POST)&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/5008.image_5F00_63B806E0.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8712.image_5F00_thumb_5F00_0366E0A9.png" width="668" height="405" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Whereas in the Get method we return a stream, in the POST case we simply accept a stream. In this case we need to create the directory if it does not exist and write the document to disk so there’s a bit more work.&lt;/p&gt;  &lt;p&gt;Here’s the logic:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The method is annotated with WebInvoke with the method set to POST. Similar to the GET, the UriTemplate is set to “*” to match everything. &lt;/li&gt;    &lt;li&gt;Next I grab on to the uri of the request so that I can return it later as part of the Location header in the response. This is appropriate according to the HTTP spec. It’s important that I grab it before I actually stream the file as I found if I wait till after, the request is disposed and I get an exception. &lt;/li&gt;    &lt;li&gt;Similar to the GET I also grab the path segments to create the file name and create the local path. &lt;/li&gt;    &lt;li&gt;Next I check to see if the directory that was requested actually exists. If it does not, I create it. &lt;/li&gt;    &lt;li&gt;I create a stream to write the file to disc and use the convenient CopyTo method to copy the incoming stream to it. &lt;/li&gt;    &lt;li&gt;Finally I set the status code to Created and set the location header. &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Testing out the app&lt;/h1&gt;  &lt;p&gt;That’s it, the app is done. Now all there is to do is launch it and see the streaming in action as well. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7651.image_5F00_19011946.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4431.image_5F00_thumb_5F00_7016043C.png" width="455" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Like I said, simple UI. &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7144.wlEmoticon_2D00_smile_5F00_545540AB.png" /&gt; . Go press “Browse” and then grab an image or a video. In this case I’ll grab the sample wildlife.wmv included in win7.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6165.image_5F00_66D9C8FB.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6560.image_5F00_thumb_5F00_4937C82F.png" width="465" height="293" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next enter “Videos” for the folder. You can also put a deep hierarchy if you want like Foo/Bar/Baz.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3022.image_5F00_3465CFAF.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1768.image_5F00_thumb_5F00_2331F20C.png" width="451" height="257" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select Upload and you will see the following once it completes.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0602.image_5F00_203C8D59.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2330.image_5F00_thumb_5F00_2B85A196.png" width="462" height="264" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now that the file is uploaded, it can be retrieved from the browser.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0880.image_5F00_0306BF82.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4186.image_5F00_thumb_5F00_586ADEA4.png" width="480" height="179" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Which in this case will cause Windows media player to launch and show our video,….w00t!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8306.image_5F00_0EF889E9.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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2043.image_5F00_thumb_5F00_22D1D0E5.png" width="500" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now that our document store is in place, we can use different clients to access it. In this example we used a browser / MVC application to keep things simple. The same store can also be accessed from a mobile device line an IPad,, a Silverlight application, or from a desktop application. All it needs is a way to talk HTTP.&lt;/p&gt;  &lt;h1&gt;Why not just MVC?&lt;/h1&gt;  &lt;p&gt;I know some folks are going to see this and say “why didn’t you just use MVC?'”.&amp;#160; I could have accomplished the upload / retrieval completely through MVC. The main point of this post however was to show how you can use streaming with WCF. Let’s move on &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7144.wlEmoticon_2D00_smile_5F00_545540AB.png" /&gt;&lt;/p&gt;  &lt;p&gt;Get the code here: &lt;a title="http://cid-f8b2fd72406fb218.office.live.com/self.aspx/blog/DocumentStore.zip" href="http://cid-f8b2fd72406fb218.office.live.com/self.aspx/blog/DocumentStore.zip"&gt;http://cid-f8b2fd72406fb218.office.live.com/self.aspx/blog/DocumentStore.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10096305" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=7pOlWOv0HfM:kjWA_GM8K0M:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=7pOlWOv0HfM:kjWA_GM8K0M:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=7pOlWOv0HfM:kjWA_GM8K0M:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=7pOlWOv0HfM:kjWA_GM8K0M:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=7pOlWOv0HfM:kjWA_GM8K0M:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=7pOlWOv0HfM:kjWA_GM8K0M:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=7pOlWOv0HfM:kjWA_GM8K0M:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/Streaming/">Streaming</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/11/24/streaming-over-http-with-wcf.aspx</feedburner:origLink></item><item><title>Are you using WCF within your organization?</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/9jBtVo5V9oM/are-you-using-wcf-within-your-organization.aspx</link><pubDate>Tue, 16 Nov 2010 21:06:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10092158</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10092158</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/11/16/are-you-using-wcf-within-your-organization.aspx#comments</comments><description>&lt;p&gt;Do you use WCF within your organization either for internal apis for exposing services and functionality to 3rd parties? We’re looking to connect with customers using our stuff in the real world so we can understand your use cases, the things you’ve liked about WCF and where you’d like to see us improve / go further. If interested, please &lt;a href="http://blogs.msdn.com/b/gblock/contact.aspx"&gt;contact&lt;/a&gt; me.&lt;/p&gt;  &lt;p&gt;We look forward to hearing from you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10092158" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=9jBtVo5V9oM:TtE78HIzXw4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=9jBtVo5V9oM:TtE78HIzXw4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=9jBtVo5V9oM:TtE78HIzXw4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=9jBtVo5V9oM:TtE78HIzXw4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=9jBtVo5V9oM:TtE78HIzXw4:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=9jBtVo5V9oM:TtE78HIzXw4:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=9jBtVo5V9oM:TtE78HIzXw4:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/11/16/are-you-using-wcf-within-your-organization.aspx</feedburner:origLink></item><item><title>WCF Web APIs, HTTP your way</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/ZQogv1xRUxo/wcf-web-apis-http-your-way.aspx</link><pubDate>Mon, 01 Nov 2010 10:13:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10083937</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>21</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10083937</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/11/01/wcf-web-apis-http-your-way.aspx#comments</comments><description>&lt;p&gt;At PDC in my session&amp;#160; &lt;a href="http://player.microsoftpdc.com/Session/17a9e09f-4af1-4ef3-8a5a-ebf1e9bd9c8e"&gt;“Building Web APIs for the Highly Connected Web”&lt;/a&gt; we announced WCF Web APIs, new work we are doing to make HTTP first class in WCF. In this post I am going to describe what we are doing and why. If you are saying, “just show me the bits”, then just head on over to &lt;a href="http://wcf.codeplex.com"&gt;wcf.codeplex.com&lt;/a&gt; our new site that we just launched! &lt;/p&gt;  &lt;h1&gt;Why HTTP?&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3542.image_5F00_thumb17_5F00_5659E48E.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 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_thumb[17]" border="0" alt="image_thumb[17]" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6663.image_5F00_thumb17_5F00_thumb_5F00_380F2D98.png" width="365" height="224" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;HTTP is ubiquitous and it’s lightweight.&amp;#160; Every consumer that connects to the web understands it, every browser supports it, and the infrastructure of the world wide web is built around it.&amp;#160; That means when you travel HTTP, you get carte blanche status throughout the world wide web. It’s like a credit card that is always accepted everywhere. In the past, HTTP’s primary usage was for serving up HTML pages. Over time however our web applications have evolved. These newer breed are much more dynamic, aggregating data not only from the company server but from a multitude of services that are hosted in the cloud. Many of those services themselves are now being exposed directly over HTTP in order to have maximum reach. &lt;/p&gt;  &lt;p&gt;Whereas in the past the primary consumer was a desktop / laptop PC, we’ve now moved into the age of devices including phones like IPhone, Android and Windows Phone as well as other portable tablets like the iPad and the upcoming Slate. Each of these devices (including the PC) have different capabilities, however one thing is consistent, they all talk HTTP.&lt;/p&gt;  &lt;h1&gt;WCF and HTTP, we’re going much further.&lt;/h1&gt;  &lt;p&gt;As the industry evolves, our platform needs to evolve. Since .NET 3.5, we have been continually evolving WCF to provide better support for surfacing services and data over HTTP.&amp;#160; We’ve made good progress but there is more we can do. Developers using WCF have said they want more control over HTTP. We’ve also heard developers asking for better support for consuming WCF services with web toolkits like jQuery. Additionally, we’ve heard requests about simplifying configuration, removing ceremony, more testability, and just an overall simplified model. &lt;strong&gt;We hear you and we’re taking action. &lt;/strong&gt;We’re making significant enhancements to our platform to address the concerns.&amp;#160; Below is a list of some of the improvements we are focusing on specific to HTTP which we just made available on Codeplex (available in WCF HTTP Preview 1.zip). For the jQuery work check out these excellent posts by &lt;a href="http://tomasz.janczuk.org/2010/10/wcf-support-for-jquery-on.html"&gt;Tomek&lt;/a&gt; and &lt;a href="http://hashtagfail.com/post/1432485895/jsonvalue-json-walkthrough"&gt;Yavor&lt;/a&gt;..&lt;/p&gt;  &lt;h1&gt;Our HTTP focus areas&lt;/h1&gt;  &lt;h2&gt;Media Types and Formats&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/6675.image_5F00_thumb11_5F00_67CCD617.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 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_thumb[11]" border="0" alt="image_thumb[11]" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3652.image_5F00_thumb11_5F00_thumb_5F00_50A15B99.png" width="369" height="209" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;HTTP is extremely flexible allowing the body to be presented in many different media types (content type) with html, pure xml and json, atom and OData being just a few. With WCF Web APIs we’re going to make it very easy for services to support multiple formats on a single service. Out of the box, we are planning to support xml, json and OData however we’re also making it very easy to add on support for additional media types including those that contain &lt;a href="http://amundsen.com/hypermedia/"&gt;hypermedia&lt;/a&gt; (see my talk for an exampe). This gives WCF the flexibility to service a variety clients based on their needs and capabilities.&lt;/p&gt;  &lt;p&gt;Below is a snippet which demonstrates taking a contact returned from an operation and representing it as a png file stored in an images folder. PngProcessor derives from MediaTypeProcessor. Processors are a new extensibility point in WCF Web APIs. MediaTypeProcessor is a special processor that you derive from to support a new format.&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; PngProcessor : MediaTypeProcessor
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; PngProcessor(HttpOperationDescription operation, &lt;/p&gt;&lt;p&gt;        MediaTypeProcessorMode mode)
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        : &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;(operation, mode)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; SupportedMediaTypes
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            yield &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &amp;quot;&lt;span style="color: #8b0000"&gt;image/png&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; WriteToStream(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; instance, &lt;/p&gt;&lt;p&gt;        Stream stream, HttpRequestMessage request)
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var contact = instance &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; Contact;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contact != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;            var path = &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(CultureInfo.InvariantCulture, &lt;/p&gt;&lt;p&gt;                @&amp;quot;&lt;span style="color: #8b0000"&gt;{0}bin\Images\Image{1}.png&lt;/span&gt;&amp;quot;, &lt;/p&gt;&lt;p&gt;                AppDomain.CurrentDomain.BaseDirectory, &lt;/p&gt;&lt;p&gt;                contact.ContactId);
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (var fileStream = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FileStream(path, FileMode.Open))
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;byte&lt;/span&gt;[] bytes = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;byte&lt;/span&gt;[fileStream.Length];
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                fileStream.Read(bytes, 0, (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)fileStream.Length);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;                stream.Write(bytes, 0, (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)fileStream.Length);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; ReadFromStream(Stream stream, &lt;/p&gt;&lt;p&gt;        HttpRequestMessage request)
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NotImplementedException();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;This &lt;em&gt;same&lt;/em&gt; Png formatter can sit side by side with formatters for other media types like json, xml, and atom. WCF will automatically select the right processor based on matching the request accept headers passed from the client against the SupportedMediaTypes. &lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;p&gt;To see different media types in action, check the ContactManager sample that ships with WCF Web APIs.&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;Registering formatters / processors&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;In order to register processors, we’re exploring a new programmatic configuration model which allows you to configure all processors (including formatters) at a single place within your application. To configure processors, you derive from a HostConfiguration class and override a few methods. You then pass your custom configuration class to the WebHttpServiceHost or WebHttpServiceHostFactory.&lt;/p&gt;

&lt;p&gt;In the ContactManager sample we’re shipping on Codeplex you wll see the following in the Global.asax.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Application_Start(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var configuration = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ContactManagerConfiguration();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    RouteTable.Routes.AddServiceRoute&amp;lt;ContactResource&amp;gt;(&lt;/p&gt;&lt;p&gt;        &amp;quot;&lt;span style="color: #8b0000"&gt;contact&lt;/span&gt;&amp;quot;, configuration);&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    RouteTable.Routes.AddServiceRoute&amp;lt;ContactsResource&amp;gt;(&lt;/p&gt;&lt;p&gt;        &amp;quot;&lt;span style="color: #8b0000"&gt;contacts&lt;/span&gt;&amp;quot;, configuration);
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;p&gt;Both the ContactResource and ContactsResource are configured with a ContactManagerConfiguration instance. That class registers the processors for each operation.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ContactManagerConfiguration : HostConfiguration
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterRequestProcessorsForOperation(&lt;/p&gt;&lt;p&gt;        HttpOperationDescription operation, 
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        IList&amp;lt;Processor&amp;gt; processors, MediaTypeProcessorMode mode)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JsonProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FormUrlEncodedProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterResponseProcessorsForOperation(&lt;/p&gt;&lt;p&gt;        HttpOperationDescription operation, 
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        IList&amp;lt;Processor&amp;gt; processors, MediaTypeProcessorMode mode)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JsonProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PngProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Notice above the request is configured to support Json and FormUrlEncoding while the response supports Json and Png. These Register methods are called per operation thus configuration of processors can even be more fine grained. Plus you can reuse your configuration classes even across applications.&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;JsonProcessor / FormUrlEncodedProcessor.&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;In addition to supporting representing types in multiple formats, we also can support untyped operations with the new Json primitives that come out of our jQuery work which I mentioned above. The JsonValueSample we’ve included illustrates how this works.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[ServiceContract]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ContactsResource
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&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;int&lt;/span&gt; nextId = 1;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    [WebInvoke(UriTemplate = &amp;quot;&lt;span style="color: #8b0000"&gt;&lt;/span&gt;&amp;quot;, Method = &amp;quot;&lt;span style="color: #8b0000"&gt;POST&lt;/span&gt;&amp;quot;)]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; JsonValue Post(JsonValue contact)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var postedContact = (dynamic)contact;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var contactResponse = (dynamic)&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JsonObject();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        contactResponse.Name = postedContact.Name;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        contactResponse.ContactId = nextId++;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; contactResponse;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;u&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;In the snippet above you can see that the Post method accepts a JsonValue and returns a JsonValue. Within it casts the incoming parameter to dynamic (there actually is an extension method AsDynamic which you can use) pulls out the name and then creates a new JsonObject which it sets some properties on and returns. &lt;/p&gt;

&lt;p&gt;If you look in the JsonValueSampleConfiguration you will see that it accepts Form Url Encoding (something not previously possible in WCF without a lot of work) for the request and returns Json. &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; JsonValueSampleConfiguration : HostConfiguration
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterRequestProcessorsForOperation(&lt;/p&gt;&lt;p&gt;        HttpOperationDescription operation, &lt;/p&gt;&lt;p&gt;        IList&amp;lt;Processor&amp;gt; processors, &lt;/p&gt;&lt;p&gt;        MediaTypeProcessorMode mode)
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FormUrlEncodedProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterResponseProcessorsForOperation(&lt;/p&gt;&lt;p&gt;        HttpOperationDescription operation, &lt;/p&gt;&lt;p&gt;        IList&amp;lt;Processor&amp;gt; processors, &lt;/p&gt;&lt;p&gt;        MediaTypeProcessorMode mode)
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.ClearMediaTypeProcessors();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        processors.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JsonProcessor(operation, mode));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;This is extremely powerful for folks solely working with Uri Form Encoding and Json and who are comfortable/prefer working without a concrete type.&lt;/p&gt;

&lt;h2&gt;Queryability&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1563.image_5F00_thumb13_5F00_6B6D81A5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 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_thumb[13]" border="0" alt="image_thumb[13]" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7356.image_5F00_thumb13_5F00_thumb_5F00_7B101D67.png" width="316" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One challenge when exposing data over HTTP is how to allow clients to filter that data.&amp;#160; In WCF Web APIs we’re introducing IQueryable support on the client and server for addressing these challenges. &lt;/p&gt;

&lt;h3&gt;&lt;u&gt;Making the service queryable&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;On the server side, your service operation returns an IQueryable&amp;lt;T&amp;gt; and you annotate it with a [QueryComposition] attribute. Once you do that, your service lights up and is now queryable using the OData uri format. &lt;/p&gt;

&lt;p&gt;We’ve included a QueryableSample which illustrates how this works. Below is a snippet from the CoontactsResource in that sample.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[WebGet(UriTemplate = &amp;quot;&lt;span style="color: #8b0000"&gt;&lt;/span&gt;&amp;quot;)]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[QueryComposition]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IEnumerable&amp;lt;Contact&amp;gt; Get()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; contacts.AsQueryable();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The Get method above returns an IQueryable of contacts. (Today the method must return IEnumerable&amp;lt;Contact&amp;gt; but this will be fixed in the near future).&lt;/p&gt;

&lt;p&gt;With the query composition enabled, the host will now accept requests like “&lt;a title="http://localhost:8081/contacts?$filter=Id%20eq%201" href="http://localhost:8081/contacts?$filter=Id%20eq%201"&gt;http://localhost:8081/contacts?$filter=Id%20eq%201&lt;/a&gt;” which says “find me the contact with an ID equal to 1”.&lt;/p&gt;

&lt;p&gt;Note: Currently this feature is not compatible with our new WebHttpServiceHost / Processors, it only works with our existing WebServiceHost. This is temporary as we are planning to migrate over to the new host / processor model.&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;Querying the service, LINQ to WCF&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;On the client side we’re introducing the ability to do LINQ queries directly to resources which are exposed through query composition. We’ve added a CreateQuery&amp;lt;T&amp;gt; extension method which you can use with the new HttpClient (next section) to create a WebQuery&amp;lt;T&amp;gt;. Once you have that query, you can then apply a Where, or an Order by. Once you start to iterate through the result, we will automatically do a Get request to the server using the correct URI based on the filter. The results will come back properly ordered and filtered based on your query.&lt;/p&gt;

&lt;p&gt;Below is a snippet that shows querying an Orders resource &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IEnumerable&amp;lt;Order&amp;gt; GetApprovedOrders()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; address = &amp;quot;&lt;span style="color: #8b0000"&gt;http://contoso.com/orders&lt;/span&gt;&amp;quot;;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    HttpClient client = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpClient(address);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    WebQuery&amp;lt;Order&amp;gt; orders = client.CreateQuery&amp;lt;Contact&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; orders.Where&amp;lt;Order&amp;gt;(o=&amp;gt;o.State == OrderState.Approved).&lt;/p&gt;&lt;p&gt;        OrderBy(o=o.OrderID);    
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;h2&gt;Getting first class support for HTTP&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2475.image_5F00_thumb16_5F00_11D1F5A2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 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_thumb[16]" border="0" alt="image_thumb[16]" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4520.image_5F00_thumb16_5F00_thumb_5F00_015984A7.png" width="331" height="250" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTTP is more than a transport, it is a rich application layer protocol. There’s a lot more interesting information than just the body which lives in the headers. It is the headers that most of the web infrastructure actually cares about. For example if you want to allow requests to be cached throughout the web, you need to use entity tags which live where? In the headers. Point blank,&amp;#160; if you want to access the full richness of HTTP you need to access those headers. &lt;/p&gt;

&lt;h3&gt;&lt;u&gt;HTTP Messages&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;We’re introducing support for HttpRequestMessage and HttpResponseMessage. These classes which originally shipped in the REST starter kit allow unfettered and strongly typed access to the underlying HTTP request and response.&amp;#160; With these new apis you can access HTTP&amp;#160; wherever you are, whether you are authoring a service, or extending the stack and whether you are on the server &lt;strong&gt;or the client. &lt;/strong&gt;Another nice thing about these messages is they are easy to use in unit testing. They don’t have any implicit dependencies to WCF as WebOperationContext does nor are they statically called. They are lightweight data containers that are very easy to create.&lt;/p&gt;

&lt;p&gt;For example, you can author a service which receives the HttpRequestMessage and HttpResponseMessage, and which directly accesses the headers and the body. The HelloWorldResource below supports caching on the client side, as it returns an entity tag “HW” which the client can send in an IfNoneMatch header in subsequent requests. The resource can then then return a status 304 to tell the client to use it’s cached copy. The client in this case might not be the browser but a proxy server sitting in the middle.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[ServiceContract]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; HelloWorldResource {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  [WebGet(UriTemplate=&amp;quot;&lt;span style="color: #8b0000"&gt;&lt;/span&gt;&amp;quot;)]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Get(HttpRequestMessage req, HttpResponseMessage resp) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (req.IfNoneMatch.Contains(&amp;quot;&lt;span style="color: #8b0000"&gt;HW&lt;/span&gt;&amp;quot;)) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;      resp.StatusCode = HttpStatusCode.NotModified;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;      &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    resp.HttpContent.Create(&amp;quot;&lt;span style="color: #8b0000"&gt;Hello World Resource&lt;/span&gt;&amp;quot;, &amp;quot;&lt;span style="color: #8b0000"&gt;text/html&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    resp.StatusCode = HttpStatusCode.OK;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    resp.Headers.Tag = &amp;quot;&lt;span style="color: #8b0000"&gt;HW&lt;/span&gt;&amp;quot;; &lt;span style="color: #008000"&gt;//set the tag&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The code above would likely be factored into a common set of utility functions rather than being redundantly coded for each operation. The important thing is we’re providing the messages which enables that refactoring.&lt;/p&gt;

&lt;p&gt;You can also mix and match using messages with strongly typed objects representing the body. For example you might want to do a redirect on a Get request for a document that has moved.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[ServiceContract]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; DocumentResource
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    [WebGet(UriTemplate=&amp;quot;&lt;span style="color: #8b0000"&gt;{name}&lt;/span&gt;&amp;quot;)]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Document Get(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, HttpResponseMessage resp)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Document doc;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;//foo has moved&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (name == &amp;quot;&lt;span style="color: #8b0000"&gt;Foo&lt;/span&gt;&amp;quot;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            resp.StatusCode = HttpStatusCode.MovedPermanently;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            resp.Headers.Location = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(&amp;quot;&lt;span style="color: #8b0000"&gt;http://someplace/Foo&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;//find the document&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; doc;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;} &lt;/pre&gt;&lt;u&gt;&lt;/u&gt;&lt;/pre&gt;
&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;

&lt;p&gt;Within the ContactManager sample you will see other examples of mixing messages with concrete types.&amp;#160; &lt;/p&gt;

&lt;h3&gt;&lt;u&gt;HTTP Client&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;Providing a client for consuming HTTP is equally as important as being able to expose it. For that reason we’re also bringing the HttpClient we shipped in the REST starter kit forward. You can use the new client within desktop applications or within services themselves in order to consume other HTTP services. We’re also providing extensions to the client for supporting queryability, which I will cover in the next section.&lt;/p&gt;

&lt;p&gt;Below is a simple example of using HttpClient.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var client = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpClient();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;client.DefaultHeaders.Accept.Add(&amp;quot;&lt;span style="color: #8b0000"&gt;text/xml&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;var resp = client.Get(&amp;quot;&lt;span style="color: #8b0000"&gt;http://contoso.com/contacts/1&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;resp.Content.ReadAsXmlSerializable&amp;lt;Contact&amp;gt;();
&lt;/pre&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;u&gt;Request and response processing&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0804.image_5F00_thumb19_5F00_57E54366.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 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_thumb[19]" border="0" alt="image_thumb[19]" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1586.image_5F00_thumb19_5F00_thumb_5F00_12CC7630.png" width="356" height="202" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you work with HTTP, there are various parts of the request and response which need to be processed or transformed &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1323.wlEmoticon_2D00_smile_5F00_4F196158.png" /&gt;. With HttpRequestMessage and HttpResponseMessage we’re allowing you to do this processing within the actual operation as there are places where this is appropriate. However, there are other cases that are concerns that are cross-cutting which don’t belong in the operation. Take formatting for example. It’s very convenient to have the ContactResource simply return and accept a contact, rather than it have to drop down to a message and manually do the formatting. In the same way the ContactResource operation may depend on certain values extracted from segments of the request URI like the ID. In the past we dealt with each of these concerns in a one-off basis. With WCF Web APIs we’re exploring a more general purpose way to handle these concerns. We’re introducing&amp;#160; a request and response pipeline of what we’re currently calling Processors. A Processor has a simple execute method with takes inputs and provides outputs. The inputs could be things like the request or response, or outputs from other processors. In this way processors are composable. &lt;/p&gt;

&lt;p&gt;Out of the box we use processors today mainly for extracting values from the uri, for content negotation (selecting the format) and for media type formatters. However processors are extensible, and you can introduce your own for adding custom processing within the request or the response.&lt;/p&gt;

&lt;p&gt;We’ve already seen above how to create processors specific for formatting. Here is an example of a different kind of processor that takes a latitude and longitude in a URI for example “http://contoso/map/12.3456,-98.7654” and converts it into Location object. Once the location processor is registered, the MapResource.Get method will automatically get a location object passed in. &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Location
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; Latitude { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; Longitude { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; LocationProcessor : Processor&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, Location&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; LocationProcessor()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.OutArguments[0].Name = &amp;quot;&lt;span style="color: #8b0000"&gt;Location&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; ProcessorResult&amp;lt;Location&amp;gt; OnExecute(&lt;/p&gt;&lt;p&gt;        &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; latitude, &lt;/p&gt;&lt;p&gt;        &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; longitude)
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var lat = &lt;span style="color: #0000ff"&gt;double&lt;/span&gt;.Parse(latitude);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        var lon = &lt;span style="color: #0000ff"&gt;double&lt;/span&gt;.Parse(longitude);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;p&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ProcessorResult&amp;lt;Location&amp;gt; { Output = &lt;/p&gt;&lt;p&gt;            &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Location { Latitude = lat, Longitude = lon } };
&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[ServiceContract]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MapResource {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  [UriTemplate=&amp;quot;&lt;span style="color: #8b0000"&gt;{latitude},{longitude}&lt;/span&gt;&amp;quot;]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Stream Get(Location location) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;//return the map&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The processor above inherits from Processor&amp;lt;T1, T2, TOutput&amp;gt; meaning that it takes two inputs (strings in this case) and it outputs a location. In the execute method the parameter names conventionally match against outputs coming from other processors in this case the method expects “latitude” and “longitude” params. You might be wondering where these parameters come from. If you look on the MapResource.Get method you see that it has 2 parameters named latitude and longitude respectively. A special processor UriTemplateHttpProcessor automatically extracts values from the uri and returns those values as outputs. In this case it returns latitude and longitude thus making those values available to the LocationProcessor (or any other processor).&lt;/p&gt;

&lt;p&gt;The logic above is very simple in that it parses numbers. However, you could imagine expanding the processor to do more. For example it could be rewritten to also accept a more expressive uri like “http://contoso/map/12 deg 34’ 56” N, 98 deg 76’ 54” W ”. &lt;/p&gt;

&lt;p&gt;This is just a small illustration of the kinds of things you can do with processors. You could imagine handling concerns related to entity tags like IfMatch / IfNonMatch in processors for example.&lt;/p&gt;

&lt;p&gt;There’s a lot more to say about processors and their configuration. Look for more on both topics in future posts. &lt;a href="http://www.bizcoder.com"&gt;Darrel Miller&lt;/a&gt; also has a nice post where he talks about processors &lt;a href="http://www.bizcoder.com/index.php/2010/10/28/wcf-http/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h1&gt;Conventions, Resources and Testability&lt;/h1&gt;

&lt;p&gt;We’ve heard plenty of feedback from folks in the community that they would like to see us offer configuration alternatives to attributes and provide more out of the box conventions. We’ve also heard developers asking for us to ensure that we provide better support for test driven development, and using tools like IoC containers. As we move forward we are definitely thinking about all of the above. &lt;/p&gt;

&lt;p&gt;Our current focus for the platform has been to enhance the existing Web HTTP programming model to provide richer support for HTTP. These enhancements will likely roll into the framework soon and will provide a very smooth migration path for existing WCF HTTP customers.&lt;/p&gt;

&lt;p&gt;Longer term, we are also exploring a new convention based programming model for configuring HTTP resources (services). With this new model we are also looking at how we can enhance it to be more resource oriented, for example allowing specification of child resources so that URIs can be constructed dynamically rather than being hardcoded. This new model will make it’s way to Codeplex soon where we’d like to incubate it with the community. &lt;/p&gt;

&lt;p&gt;With the new bits we are delivering we are also being intentional about designing things in a more testable manner for example HttpRequestMessage and HttpResponseMessage allow developers to move away from static calls which are difficult to test. Processors are also easy to test as they each do a single thing, and do not have static dependencies. In addition to the new bits, we are looking at investments we can make into our existing bits to better support testability. For example we are exploring allowing you to plug in an IoC container for service instantiation.&amp;#160; &lt;/p&gt;

&lt;h1&gt;It’s still early, we want your help&lt;/h1&gt;

&lt;p&gt;We’re still early in the development of these new features! Not all of these features will make it in the box, but many definitely will. You can help us prioritize by checking out our new bits on Codeplex, participating in the forums and adding work items so others can vote.&lt;/p&gt;

&lt;p&gt;OK, what are you waiting for? Head on over to &lt;a href="http://wcf.codeplex.com"&gt;wcf.codeplex.com&lt;/a&gt;. The future awaits!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10083937" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ZQogv1xRUxo:C4QCgIukZ3k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ZQogv1xRUxo:C4QCgIukZ3k:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=ZQogv1xRUxo:C4QCgIukZ3k:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ZQogv1xRUxo:C4QCgIukZ3k:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ZQogv1xRUxo:C4QCgIukZ3k:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ZQogv1xRUxo:C4QCgIukZ3k:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=ZQogv1xRUxo:C4QCgIukZ3k:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF+Web+APIs/">WCF Web APIs</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCFVNext/">WCFVNext</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/11/01/wcf-web-apis-http-your-way.aspx</feedburner:origLink></item><item><title>Taking HTTP support in WCF to the next level</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/2k4tytCBGXY/taking-http-support-in-wcf-to-the-next-level.aspx</link><pubDate>Tue, 26 Oct 2010 05:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10080712</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10080712</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/10/26/taking-http-support-in-wcf-to-the-next-level.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/0537.MP9004071511_5F00_411C71C8.jpg"&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="MP900407151[1]" border="0" alt="MP900407151[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/4353.MP9004071511_5F00_thumb_5F00_1FBCCC2C.jpg" width="244" height="164" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you are building for the web and the cloud, then you know that HTTP is important. WCF is no stranger to HTTP. Since .NET 3.5, we’ve been continually delivering capabilities in the platform to enable developers to expose services as resources over HTTP. Now we’re looking to raise the bar several notches. &lt;/p&gt;  &lt;p&gt;At PDC, I’ll be showing work we are doing to unlock the full richness of HTTP within your network based applications. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;We’re going to let you have complete control over HTTP. &lt;/li&gt;    &lt;li&gt;Support a multitude of media types (formats) i..e XML, JSON, ATOM, OData, and custom formats including those that are hypermedia driven &lt;/li&gt;    &lt;li&gt;Give you full access to your Uri and headers, &lt;/li&gt;    &lt;li&gt;Provide richer support for web frameworks like JQuery &lt;/li&gt;    &lt;li&gt;Provide a more simplified configuration story. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;That is just the beginning. We want you to have it your way with HTTP! &lt;/p&gt;  &lt;p&gt;Want to hear more? Watch my talk&lt;/p&gt;  &lt;h1&gt;Building Web APIs for the Highly Connected Web&lt;/h1&gt;  &lt;h4&gt;Friday, 9:00 AM-10:00 AM (GMT-7) &lt;/h4&gt;  &lt;h4&gt;Room: Kodiak &lt;/h4&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10080712" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=2k4tytCBGXY:LuFBCSpV9xE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=2k4tytCBGXY:LuFBCSpV9xE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=2k4tytCBGXY:LuFBCSpV9xE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=2k4tytCBGXY:LuFBCSpV9xE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=2k4tytCBGXY:LuFBCSpV9xE:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=2k4tytCBGXY:LuFBCSpV9xE:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=2k4tytCBGXY:LuFBCSpV9xE:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/talks/">talks</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/HTTP/">HTTP</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/10/26/taking-http-support-in-wcf-to-the-next-level.aspx</feedburner:origLink></item><item><title>Yet another simplification of Prism’s EventAggregator syntax part II–mocking extension methods</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/tVrfBNQHCvc/yet-another-simplification-of-prism-s-eventaggregator-syntax-part-ii-mocking-extension-methods.aspx</link><pubDate>Mon, 11 Oct 2010 05:27:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10073952</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10073952</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/10/11/yet-another-simplification-of-prism-s-eventaggregator-syntax-part-ii-mocking-extension-methods.aspx#comments</comments><description>&lt;p&gt;After my last &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2010/10/10/yea-another-simplification-of-prism-s-eventaggregator-syntax.aspx"&gt;post&lt;/a&gt;, I had quite a healthy discussion with &lt;a href="http://lostincolonisation.wordpress.com"&gt;Alex Hung&lt;/a&gt; (&lt;a href="http://twitter.com/alexhung"&gt;@alexhung&lt;/a&gt;) on you guessed it, testability and mocking. Alex’s observation was although my extension methods were easy to use, they were difficult to test. He had gone and implemented a similar user experience but through using a custom wrapper which added Publish and Subscribe methods but called to EA under the covers. His wrapper implements an interface that is easy to mock.&lt;/p&gt;  &lt;p&gt;The question then was how can you mock the new extension methods? Before getting into the how lets first answer the question of why?&lt;/p&gt;  &lt;p&gt;Here are unit tests that should illustrate what I want to do.&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[TestFixture]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; When_SelectOrder_is_invoked {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  [Test]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; then_controller_publishes_OrderSelected() 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;//mock out the event aggregator;  &lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var mock = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Mock&amp;lt;IEventAggregator&amp;gt;() 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var controller = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OrderController(mock.Object);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var order=&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Order();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    controller.SelectOrder(order);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    mock.Verify(ea=&amp;gt;ea.Publish(order));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[TestFixture]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; When_OrderViewModel_is_created {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  [Test]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; then_subscribes_to_OrderSelected() {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;//mock out the event aggregator;  &lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var mock = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Mock&amp;lt;IEventAggregator&amp;gt;() 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var vm = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OrderViewModel(mock.Object);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    mock.Verify(ea=&amp;gt;ea.Subscribe(vm.OnOrderSelected));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Looks simple enough right? I am creating a mock EventAggregator, passing it in and then verifying that the Publish and Subscribe methods are called. Both Alex and I originally though that would work. &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2678.wlEmoticon_2D00_winkingsmile_5F00_44C05749.png" /&gt; Though Alex was a bit skeptical.&lt;/p&gt;

&lt;p&gt;However the reality is that it cannot work. The reason is because I am creating a mock of IEventAggregator but the methods I want to mock are not on the event aggregator itself, they are extension methods! Yet another proof that what looks like it will work in the blackboard of your mind, often doesn’t hold up any water in the real world.&lt;/p&gt;

&lt;p&gt;There is hope though. Extension methods CAN be mocked, but it takes a bit of refactoring. Daniel Cazzulino (&lt;a href="http://twitter.com/kzu"&gt;@kzu&lt;/a&gt;) has a great post on this &lt;a href="http://www.clariusconsulting.net/blogs/kzu/archive/2009/02/19/Makingextensionmethodsamenabletomocking.aspx"&gt;here&lt;/a&gt;. The approach I came up with is based on his. For my extension methods here are the steps I went through in that refactoring.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Created an IEventAggregatorExtensionsProvider interface. This interface has all the methods from my EventAggregatorExtensions class however, the methods are all non-static (obviously) and I removed this from the first param. Other than that the signatures are the same. &lt;/li&gt;

  &lt;li&gt;Created EventAggregatorExtensionsProvider which implements IEventAggregatorExtensionsProvider. I ripped the implementation of each method out of EventAggregatorExtenions and then moved it into this provider. &lt;/li&gt;

  &lt;li&gt;Added a private static variable _Provider of type IEventAggregatorExtensionsProvider to EventAggregatorExtensions. The variable initializes itself to a new instance of EventAggregatorExtensionsProvider. &lt;/li&gt;

  &lt;li&gt;Changed all public methods in EventAggregatorExtensions to delegate directly to the _provider instance. &lt;/li&gt;

  &lt;li&gt;Added a static SetProvider method which accepts an IEventAggregatorExtensionsProvider which it then overrides _provider with. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here’s what the resulting code now looks like (which has grown a bit from my first Codepaste): &lt;a title="http://codepaste.net/woqq1d" href="http://codepaste.net/woqq1d"&gt;http://codepaste.net/woqq1d&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With these changes I can now pass in a mock of IEventAggregatorExtensionsProvider to do exactly what I want. Now my unit tests read like this:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[TestFixture]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; When_SelectOrder_is_invoked {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  [Test]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; then_controller_publishes_OrderSelected()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;//mock out the provider&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var mock = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Mock&amp;lt;IEventAggregatorExtensionsProvider&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var ea = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventAggregator();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    EventAggregatorExtensions.SetProvider(mock.Object);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var controller = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OrderController(ea);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var order = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Order();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    controller.SelectOrder(order);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    mock.Verify(p=&amp;gt;p.Publish(ea, order));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;[TestFixture]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; When_OrderViewModel_is_created {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  [Test]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; then_subscribes_to_OrderSelected()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;//mock out the provider&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var mock = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Mock&amp;lt;IEventAggregatorExtensionsProvider&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var ea = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventAggregator();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    EventAggregatorExtensions.SetProvider(mock.Object);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    var vm = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OrderViewModel(ea);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    mock.Verify(p=&amp;gt;p.Subscribe(ea, vm.OnOrderSelected));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The main difference is that I am now creating a mock of the extensions provider rather than the event aggregator itself. That means that my mock is the thing that will get invoked by the classes under test.&lt;/p&gt;

&lt;p&gt;Actually the EA instance I create in the unit tests is just a dummy and could even be null as &lt;a href="http://bradwilson.typepad.com/blog/2008/01/c-30-extension.html"&gt;extensions methods can be invoked on null instances&lt;/a&gt;. That’s because my classes under test are only accessing the extension methods. However I passed it in because it is entirely conceivable one might want to access the actual instance methods.&lt;/p&gt;

&lt;p&gt;To be fair there is more ceremony here than the approach that Alex was suggesting as you have to mock the provider and pass in an event aggregator. However the difference I think is marginal, and it works nicely and is completely testable.&lt;/p&gt;

&lt;p&gt;What do you think?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10073952" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=tVrfBNQHCvc:qxpas-ncEBI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=tVrfBNQHCvc:qxpas-ncEBI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=tVrfBNQHCvc:qxpas-ncEBI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=tVrfBNQHCvc:qxpas-ncEBI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=tVrfBNQHCvc:qxpas-ncEBI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=tVrfBNQHCvc:qxpas-ncEBI:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=tVrfBNQHCvc:qxpas-ncEBI:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/prism/">prism</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/EventAggregator/">EventAggregator</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/10/11/yet-another-simplification-of-prism-s-eventaggregator-syntax-part-ii-mocking-extension-methods.aspx</feedburner:origLink></item><item><title>Yet another simplification of Prism’s EventAggregator syntax</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/jFQMv9AJn-I/yea-another-simplification-of-prism-s-eventaggregator-syntax.aspx</link><pubDate>Mon, 11 Oct 2010 05:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10073950</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10073950</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/10/11/yea-another-simplification-of-prism-s-eventaggregator-syntax.aspx#comments</comments><description>&lt;p&gt;It’s been quite a while since I worked with Prism’s &lt;a href="http://msdn.microsoft.com/en-us/library/ff921122(v=PandP.20).aspx"&gt;EventAggregator&lt;/a&gt;. Today however I need to use it. As soon as I started to write my code, I heard my friend &lt;a href="http://codebetter.com/blogs/jeremy.miller"&gt;Jeremy Miller&lt;/a&gt; in my head saying how much he hates the ceremony of&amp;#160; GetEvent&amp;lt;&amp;gt; pattern that Prism’s EA introduces. What he is talking about is code like the following&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;//publisher&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; OrderController {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IEventAggregator _ea;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; OrderController(IEventAggregator ea) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    _ea = ea;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; SelectOrder(Order order) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    _ea.GetEvent&amp;lt;OrderSelected&amp;gt;().Publish(order);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;//subscriber&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; OrderViewModel {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; OrderViewModel(IEventAggregator ea) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    ea.GetEvent&amp;lt;OrderSelected&amp;gt;().Subscribe(OnOrderSelected());
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnOrderSelected(Order o) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;As you can see above, that each time I need to publish or subscribe, I am calling GetEvent&amp;lt;T&amp;gt;&lt;/p&gt;

&lt;p&gt;I then found my way back to my buddy Ward’s post on the subject here: &lt;a title="http://neverindoubtnet.blogspot.com/2009/07/simplify-prism-event-aggregator.html" href="http://neverindoubtnet.blogspot.com/2009/07/simplify-prism-event-aggregator.html"&gt;http://neverindoubtnet.blogspot.com/2009/07/simplify-prism-event-aggregator.html&lt;/a&gt;. In that post, Ward suggested that a way to deal with this was to create an event say OrderSelected which derives from CompositePresentationEvent&amp;lt;OrderSelected&amp;gt;and in so doing removes the need for a special payload class as the event is the payload. He then adds a set of extension methods directly to EA for handling Publish and Subscribe. Using my example above the code would now look like this with his extensions.&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;//publisher&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; OrderController {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IEventAggregator _ea;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; OrderController(IEventAggregator ea) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    _ea = ea;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; SelectOrder(Order o) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    _ea.Publish&amp;lt;OrderSelected&amp;gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;//subscriber&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; OrderViewModel {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IEventAggregator _ea;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; OrderViewModel(IEventAggregator ea) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    ea.Subscribe&amp;lt;OrderSelected&amp;gt;(OnOrderSelected);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnOrderSelected(Order o) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Which is much much cleaner. There’s no longer any need for calling GetEvent&amp;lt;T&amp;gt;(). However, there’s two parts about the approach that I just had a hard time digesting. I am not saying it is a bad approach but:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;It requires the event class to inherit from CompositePresentationEvent&amp;lt;T&amp;gt; when I would prefer not having to carry any base class requirement. &lt;/li&gt;

  &lt;li&gt;It requires that the T that it inherits from is itself. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And so over a year later, I decided to take another crack at it with a slightly different approach. This one doesn’t require any base class so it removes the 2 constraints above. It basically uses extension methods to wrap / unwrap the passed in parameter with CompositePresentationEvent. It removes you from having to know about that event at all.&lt;/p&gt;

&lt;p&gt;Rather than chop it up to make it fit the narly CodeBetter column constraints, go grab it at CodePaste &lt;a href="http://codepaste.net/uf9isv"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Makes the code nice and clean. Now my event classes are just simple pocos. It also also maintains the nice syntax that Ward achieved in his pioneering approach that led me down this path.&lt;/p&gt;

&lt;p&gt;Next step is we need an IoC autowireup facility for EventAggregator, that would make Jeremy very happy &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://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/1134.wlEmoticon_2D00_smile_5F00_47F76935.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10073950" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=jFQMv9AJn-I:_fCStAK-WnQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=jFQMv9AJn-I:_fCStAK-WnQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=jFQMv9AJn-I:_fCStAK-WnQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=jFQMv9AJn-I:_fCStAK-WnQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=jFQMv9AJn-I:_fCStAK-WnQ:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=jFQMv9AJn-I:_fCStAK-WnQ:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=jFQMv9AJn-I:_fCStAK-WnQ:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/prism/">prism</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/EventAggregator/">EventAggregator</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/10/11/yea-another-simplification-of-prism-s-eventaggregator-syntax.aspx</feedburner:origLink></item><item><title>Being fueled by developer passion</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/hnfkbyJC1Bs/being-fueled-by-developer-passion.aspx</link><pubDate>Tue, 24 Aug 2010 07:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10053475</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10053475</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/08/24/being-fueled-by-developer-passion.aspx#comments</comments><description>&lt;p&gt;Tonite I came across this really nice &lt;a href="http://kellabyte.com/2010/08/02/what-fuels-my-passion-for-technology-writing-code/"&gt;post&lt;/a&gt; from Kelly &lt;a href="http://twitter.com/kellabyte"&gt;(@kellabyte&lt;/a&gt;) on how passion drives her to continually learn and explore. She also talks about how a simple idea ends up igniting the fires and quickly spawns into putting in a lot of late nights :-) Kelly also talks about the challenge of finding an environment that lets you fulfill those desires as part of your day job rather than just in the off hours. I really appreciate Kelly&amp;rsquo;s honesty and passion, it shines through in her article.&lt;/p&gt;
&lt;p&gt;As a side note, I can totally resonate with what Kelly&amp;rsquo;s saying. I was there for over 10 years. At each place I was trying to find my &amp;ldquo;groove&amp;rdquo;, but none of the places felt quite right. Flash forward and I can say that persistence, resilience and relentlessness finally did pay off (fortunately). Certainly there were many tradeoffs in getting where I wanted to be. And although your employer might not like this, for me it meant jumping around until I found the thing that made me happy.&lt;/p&gt;
&lt;p&gt;It can happen&amp;hellip;.I am living proof!&lt;/p&gt;
&lt;p&gt;Check out Kelly&amp;rsquo;s &lt;a href="http://kellabyte.com/2010/08/02/what-fuels-my-passion-for-technology-writing-code/http://bit.ly/aBXS02"&gt;post&lt;/a&gt;. How does it resonate with you?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10053475" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=hnfkbyJC1Bs:lQJR4JnC4cY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=hnfkbyJC1Bs:lQJR4JnC4cY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=hnfkbyJC1Bs:lQJR4JnC4cY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=hnfkbyJC1Bs:lQJR4JnC4cY:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=hnfkbyJC1Bs:lQJR4JnC4cY:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=hnfkbyJC1Bs:lQJR4JnC4cY:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=hnfkbyJC1Bs:lQJR4JnC4cY:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/08/24/being-fueled-by-developer-passion.aspx</feedburner:origLink></item><item><title>Let’s meet for Dinner in London!</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/6UuA540MfEk/let-s-meet-for-dinner-in-london.aspx</link><pubDate>Tue, 13 Jul 2010 22:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10037815</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10037815</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/07/13/let-s-meet-for-dinner-in-london.aspx#comments</comments><description>&lt;p&gt;As I mentioned in my previous &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2010/07/10/bringing-mef-and-rest-love-to-the-uk-and-at-fest-10.aspx"&gt;post&lt;/a&gt;, I am in the UK for the week. &lt;a href="http://www.twitter.com/serialseb"&gt;Sebastian Lambla&lt;/a&gt; (OpenRasta) has been kind enough to organize a dinner so I can meet all my geek friends from the Isles. If are in London near Victoria on Thursday eve, 15-Jul-2010 then it would be great to meet! I am sure we&amp;rsquo;ll have some great conversation on a breadth of topics&amp;hellip;.and bitching IS allowed :-)&lt;/p&gt;
&lt;p&gt;Time: 6:30 PM&lt;/p&gt;
&lt;p&gt;Area: Somewhere in the Victoria vicinity (restaurant TBD)&lt;/p&gt;
&lt;p&gt;Register here: &lt;a href="http://dinnerwithglenn.eventbrite.com/" title="http://dinnerwithglenn.eventbrite.com/"&gt;http://dinnerwithglenn.eventbrite.com/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10037815" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=6UuA540MfEk:whOhHkdwziI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=6UuA540MfEk:whOhHkdwziI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=6UuA540MfEk:whOhHkdwziI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=6UuA540MfEk:whOhHkdwziI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=6UuA540MfEk:whOhHkdwziI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=6UuA540MfEk:whOhHkdwziI:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=6UuA540MfEk:whOhHkdwziI:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/07/13/let-s-meet-for-dinner-in-london.aspx</feedburner:origLink></item><item><title>Bringing MEF and REST love to the UK and at FEST 10</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/Y4Gn1Feza8I/bringing-mef-and-rest-love-to-the-uk-and-at-fest-10.aspx</link><pubDate>Sun, 11 Jul 2010 02:18:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10036825</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10036825</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/07/11/bringing-mef-and-rest-love-to-the-uk-and-at-fest-10.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/2577.image_5F00_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/5148.image_5F00_thumb.png" width="691" height="373" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Next week I’m coming to the UK where I’ll be spreading the MEF love at FEST 10 and in events in a few other cities. I’ll also be talking about REST and the new work we are doing in WCF to provide a better experience for building RESTful systems. &lt;/p&gt;  &lt;p&gt;Below is the event schedule&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="925"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="132"&gt;Date/Time&lt;/td&gt;        &lt;td valign="top" width="96"&gt;Event&lt;/td&gt;        &lt;td valign="top" width="112"&gt;Location&lt;/td&gt;        &lt;td valign="top" width="583"&gt;Talk(s)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="132"&gt;14 July 2010          &lt;br /&gt;10:00 AM to 2:00 PM&lt;/td&gt;        &lt;td valign="top" width="96"&gt;&lt;a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/06/03/microsoft-uk-event-managed-extensibility-framework-mef-with-glenn-block.aspx"&gt;Microsoft UK&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="112"&gt;Microsoft Campus          &lt;br /&gt;Reading&lt;/td&gt;        &lt;td valign="top" width="583"&gt;&lt;strong&gt;.NET Managed Extensibility Framework with Glenn Block [A half day of MEF]&lt;/strong&gt;           &lt;br /&gt;          &lt;br /&gt;          &lt;p&gt;The Managed Extensibility Framework (MEF) is a new library which is part of the .Net 4.0 framework. MEF helps you build extensible and maintainable applications, which you can evolve over time, by providing a mechanism that promotes decoupling and separation of concerns, and supports plugins.&lt;/p&gt;          &lt;p&gt;Come join us on this quest for enlightenment in the way of MEF. We will start our journey light with the essentials of composition in MEF: Import, Export and Compose. We will then travel together on the path as we elevate toward master.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="132"&gt;14 July 2010&amp;#160; &lt;br /&gt;7:00 PM to 9:00 PM&lt;/td&gt;        &lt;td valign="top" width="96"&gt;&lt;a href="http://www.nxtgenug.net/ViewEvent.aspx?EventID=327"&gt;NxtGenUG&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="112"&gt;Microsoft Research Cambridge&lt;/td&gt;        &lt;td valign="top" width="583"&gt;&lt;strong&gt;Silverlight Application Partitioning and Extensibility with MEF&lt;/strong&gt;           &lt;br /&gt;          &lt;br /&gt;Wouldn't it be nice if your team could add new features to your applications without all the headache they have to deal with today? With the Managed Extensiblity Framework (MEF) in 4.0 you can bolt your apps together dynamically on the fly. Adding new modules and features is as simple as deploying a new binary, you don't have to touch the existing code. You can even deploy those features as separate XAP files which can be loaded on-demand! Come to this talk for a quick tour of what MEF is, and learn how you can use it to beat out your competition.&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="132"&gt;15 July 2010 Evening&lt;/td&gt;        &lt;td valign="top" width="96"&gt;Geek Dinner&lt;/td&gt;        &lt;td valign="top" width="112"&gt;Somewhere in London near Victoria&lt;/td&gt;        &lt;td valign="top" width="583"&gt;Register here quick: &lt;a title="http://is.gd/dolgi" href="http://is.gd/dolgi"&gt;http://is.gd/dolgi&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="132"&gt;16 July 2010 &lt;/td&gt;        &lt;td valign="top" width="96"&gt;&lt;a href="http://www.nxtgenug.net/Fest10/Sessions.aspx"&gt;Fest 2010!&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="112"&gt;Bournemouth Pier          &lt;br /&gt;Bournemouth&lt;/td&gt;        &lt;td valign="top" width="583"&gt;&lt;strong&gt;Building extensible frameworks with MEF&lt;/strong&gt;           &lt;br /&gt;          &lt;br /&gt;Come to this talk where we will take a deep dive into building frameworks which can easily extended by third-parties. For the first part of the session we will learn about what MEF offers for framework authors as we build a small extensible library which leverages it. Then in the second part we’ll dive into several OSS frameworks that are utilizing MEF for extensibility. We’ll also leave plenty of time to answer any deep questions you have on MEF.           &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;REST, It’s more than Data&lt;/strong&gt;           &lt;br /&gt;          &lt;br /&gt;Today it’s very common to simply throw some data over the wire and call it REST. But REST as Roy Fielding described it is much, much more. Come to this session and we’ll explore the tenants of a RESTful system. We’ll start with looking at traditional web services, then we’ll remove the SOAP shackles and explore what we can achieve as we get closer and closer to HTTP. We’ll also look at various frameworks both within and outside Microsoft for achieving REST Nirvana.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;strong&gt;All of this is made possible by the fine folks at &lt;/strong&gt;&lt;a href="http://www.nxtgenug.net/"&gt;&lt;strong&gt;NxtGenUG&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; who have been gracious to sponsor my trip. &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I look forward to seeing all of you on the other side of the Atlantic!!! &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10036825" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Y4Gn1Feza8I:0M3Q0iA54PI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Y4Gn1Feza8I:0M3Q0iA54PI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=Y4Gn1Feza8I:0M3Q0iA54PI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Y4Gn1Feza8I:0M3Q0iA54PI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Y4Gn1Feza8I:0M3Q0iA54PI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=Y4Gn1Feza8I:0M3Q0iA54PI:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=Y4Gn1Feza8I:0M3Q0iA54PI:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/silverlight/">silverlight</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MEF/">MEF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/07/11/bringing-mef-and-rest-love-to-the-uk-and-at-fest-10.aspx</feedburner:origLink></item><item><title>Help my friend Scott Hanselman raise $50000 for Diabetes!</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/snDpRB6WlmI/help-my-friend-scott-hanselman-raise-50000-for-diabetes.aspx</link><pubDate>Thu, 08 Jul 2010 09:30:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10035830</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10035830</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/07/08/help-my-friend-scott-hanselman-raise-50000-for-diabetes.aspx#comments</comments><description>&lt;p&gt;&lt;img height="253" width="190" src="http://main.diabetes.org/images/friendraiser_uploads/4753.1645341079.custom.jpg" align="center" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve got a good friend &lt;a href="http://www.hanselman.com/blog/"&gt;&lt;span style="color: #669966;"&gt;Scott&lt;/span&gt;&lt;/a&gt;. He works at Microsoft, he&amp;rsquo;s a technical leader, and an awesome individual. He also lives every day plagued with being a Type I diabetic. I have known Scott for years and never realized just &lt;a href="http://www.youtube.com/v/jsxFbDIvQRw&amp;amp;color1=0xb1b1b1&amp;amp;color2=0xd0d0d0&amp;amp;hl"&gt;&lt;span style="color: #669966;"&gt;what he and others like him go through&lt;/span&gt;&lt;/a&gt; each day as he struggles with this illness. As a matter of fact you can spend quite a bit of time with him without even having a clue of his condition as he is so good at hiding it. Scott never complains, instead he takes action whether it is promoting awareness of Diabetes or helping to raise money to find a cure. &lt;/p&gt;
&lt;p&gt;Scott has now set out to raise $50000 dollars for the ADA &lt;a href="http://www.hanselman.com/blog/TeamHanselmanAndDiabetesWalk2010.aspx"&gt;&lt;span style="color: #669966;"&gt;Diabetes Walk 2010&lt;/span&gt;&lt;/a&gt;. $30000 has been raised so far, that leaves $20000 to go. &lt;strong&gt;He needs your help.&lt;/strong&gt; &lt;strong&gt;Help him! (and all others that will beneift)&lt;/strong&gt; I and many others did. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://main.diabetes.org/PageServer?pagename=OUT_homepage"&gt;&lt;img height="112" width="240" src="http://main.diabetes.org/images/SO_09/stepoutlogocity.jpg" alt="Step Out Logo" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Watch the video, get educated, help find a cure!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10035830" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=snDpRB6WlmI:P2nxVa3cagM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=snDpRB6WlmI:P2nxVa3cagM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=snDpRB6WlmI:P2nxVa3cagM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=snDpRB6WlmI:P2nxVa3cagM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=snDpRB6WlmI:P2nxVa3cagM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=snDpRB6WlmI:P2nxVa3cagM:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=snDpRB6WlmI:P2nxVa3cagM:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/Misc/">Misc</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/07/08/help-my-friend-scott-hanselman-raise-50000-for-diabetes.aspx</feedburner:origLink></item><item><title>Open sourced .NET libraries in Mono</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/dWVtQc-3KFU/open-sourced-net-libraries-in-mono.aspx</link><pubDate>Thu, 08 Jul 2010 08:46:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10035817</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10035817</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/07/08/open-sourced-net-libraries-in-mono.aspx#comments</comments><description>&lt;p&gt;Recently &lt;a href="http://tirania.org/blog/archive/2010/Jul-07.html"&gt;Miguel&lt;/a&gt; did a &lt;a href="http://tirania.org/blog/archive/2010/Jul-07.html"&gt;post&lt;/a&gt; that made me smile. He talked about several libraries from Microsoft which were released under an OSS license and thus incorporated into the Mono tree and ship as part of Mono 2.8. I smiled for two reasons. One, I was happy to see that Microsoft is becoming more and more open with our development platform. Second, I was happy because MEF was on that list. :-)&lt;/p&gt;  &lt;p&gt;The full list is below:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;a href="http://mef.codeplex.com/"&gt;Managed Extensibility Framework&lt;/a&gt;, a framework to create extensible applications (&lt;a href="http://tirania.org/blog/archive/2008/Oct-02.html"&gt;blogged about their open sourcing&lt;/a&gt;). &lt;/li&gt;  &lt;li&gt;The &lt;a href="http://dlr.codeplex.com/"&gt;Dynamic Language Runtime&lt;/a&gt; is the engine that powers IronPython and IronRuby, but also third party efforts like IronJS and RemObject's Javascript compiler. This lives largely in the System.Core assembly in .NET 4. Some of the code is also used in Mono's version of System.Numerics. &lt;/li&gt;  &lt;li&gt;OData's .NET client (System.Data.Services.Client), I blogged about this &lt;a href="http://tirania.org/blog/archive/2010/Mar-22.html"&gt;here&lt;/a&gt;. &lt;/li&gt;  &lt;li&gt;&lt;a href="http://www.asp.net/mvc"&gt;ASP.NET MVC&lt;/a&gt; both MVC1 and MVC2. &lt;/li&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb398874.aspx"&gt;Microsoft's AJAX&lt;/a&gt; library for use with ASP.NET WebForms. &lt;/li&gt;  &lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=EB83ED4C-AC85-4DE9-8395-285628EE2254&amp;amp;displaylang=en"&gt;Silverlight's Controls&lt;/a&gt;, these are used by &lt;a href="http://www.go-mono.com/moonlight"&gt;Moonlight&lt;/a&gt;.&lt;/li&gt;  &lt;/ul&gt;&lt;p&gt;I hope this is just the beginning!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10035817" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=dWVtQc-3KFU:2UnaSkeB2xE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=dWVtQc-3KFU:2UnaSkeB2xE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=dWVtQc-3KFU:2UnaSkeB2xE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=dWVtQc-3KFU:2UnaSkeB2xE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=dWVtQc-3KFU:2UnaSkeB2xE:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=dWVtQc-3KFU:2UnaSkeB2xE:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=dWVtQc-3KFU:2UnaSkeB2xE:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MEF/">MEF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MSPL/">MSPL</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/07/08/open-sourced-net-libraries-in-mono.aspx</feedburner:origLink></item><item><title>RESTing from MEF (or The MEF dealer is at REST)</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/xhVmjPZUIb8/resting-from-mef-or-the-mef-dealer-is-at-rest.aspx</link><pubDate>Wed, 30 Jun 2010 09:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10032702</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10032702</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/06/30/resting-from-mef-or-the-mef-dealer-is-at-rest.aspx#comments</comments><description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/8015.MP900302905_5B00_1_5D005F00_2.jpg"&gt;&lt;img height="321" width="449" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/7103.MP900302905_5B00_1_5D005F00_thumb.jpg" alt="MP900302905[1]" border="0" title="MP900302905[1]" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Side note: I am having serious writer&amp;rsquo;s block these days&amp;hellip;.or maybe it&amp;rsquo;s twitter&amp;rsquo;s block :-)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Continuing the tradition of overdue posts&amp;hellip;&amp;hellip;.It&amp;rsquo;s been over a month since i left the MEF team. Before moving on let me say that working on MEF was a fantastic experience! The team is very excited to see all the community interest and adoption we&amp;rsquo;re seeing with MEF in commercial products, internal applications, as well as OSS projects. Thank you all for your support over these past two years.&lt;/p&gt;
&lt;h1&gt;Where am I?&lt;/h1&gt;
&lt;p&gt;I&amp;rsquo;ve moved over to the WCF team where i am now RESTing :-) My focus is on providing platform support for distributed applications that communicate over &lt;a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol"&gt;HTTP&lt;/a&gt; and which conform to a &lt;a href="http://www.infoq.com/articles/mark-baker-REST"&gt;RESTful&lt;/a&gt; style. If you are using WCF, then you may be familiar with &lt;a href="http://msdn.microsoft.com/en-us/library/bb412172.aspx"&gt;WCF WEB HTTP&lt;/a&gt; which shipped with the .NET Framework and the &lt;a href="http://www.asp.net/downloads/starter-kits/wcf-rest"&gt;REST Starter kit&lt;/a&gt; which shipped out of band. That&amp;rsquo;s my team. &lt;/p&gt;
&lt;h1&gt;Why HTTP and REST.&lt;/h1&gt;
&lt;p&gt;HTTP is the application layer protocol that the web is built on. Browse to any web page and you immediately see HTTP in action in this case for delivering HTML web pages. HTTP is not limited as a transfer for HTML, it&amp;rsquo;s much richer. You can use&amp;nbsp; HTTP for delivering data as well as core application functionality, and you don&amp;rsquo;t have to use SOAP to do it. Applying the constraints of &lt;a href="http://www.infoq.com/articles/rest-introduction"&gt;REST&lt;/a&gt; lets you take direct advantage of the capabilities HTTP provides in order to achieve greater scalability, performance and evolveability.&lt;/p&gt;
&lt;p&gt;For example if you are using a blog reader to read this post, then it is very likely that you have subscribed to an Atom feed. &lt;a href="http://www.ietf.org/rfc/rfc4287.txt"&gt;AtomPub&lt;/a&gt; is one popular incarnation of RESTful principles that is primarily used for data feeds such as a blog, a video queue, etc. If you&amp;rsquo;ve heard our recent announcements about &lt;a href="http://www.odata.org/"&gt;OData&lt;/a&gt;, it builds on top of AtomPub to provide a protocol for querying and updating data. Another popular usage of REST services is for building AJAX style applications which communicate with the server using JSON. REST however is not at all limited to these scenarios, as a matter of fact you can apply REST to solve many of the problems that today you are doing through SOAP based services albeit in a different (and many argue simpler) fashion.&lt;/p&gt;
&lt;h1&gt;It&amp;rsquo;s not WS-* and that is a good thing&lt;/h1&gt;
&lt;p&gt;REST doesn&amp;rsquo;t bring all the bells and whistles of the WS-* protocols, however&lt;strong&gt; its power is in its simplicity&lt;/strong&gt;. That means no SOAP client stack required. For many systems the &amp;ldquo;power&amp;rdquo; WS-* brings is unnecessary, and that power is not free, that means it can turn into a tax. That doesn&amp;rsquo;t mean WS-* in itself is bad&amp;hellip;it definitely provides value.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a growing momentum in the &lt;a href="http://groups.yahoo.com/group/rest-discuss/"&gt;community&lt;/a&gt; and the enterprise for building RESTful systems and for frameworks which enable that. Take a look at &lt;a href="http://www.programmableweb.com/apis/directory/1?protocol=REST"&gt;programmableweb.com&lt;/a&gt; and you&amp;rsquo;ll see 1500 APIs listed under the REST category. These APIs run the gambit in terms of their application of RESTful principles, but regardless it is clear that companies are looking more and more to expose their systems over HTTP.&lt;/p&gt;
&lt;h1&gt;Why do we need something new?&lt;/h1&gt;
&lt;p&gt;One word, Freedom. Freedom to work directly with the protocol and freedom to harness all of it&amp;rsquo;s richness.&lt;/p&gt;
&lt;p&gt;The work we did in WCF 3.5 and 4.0 was a great first step. It allows you to use the traditional WCF service model and tweak it to behave well over HTTP. However, it has it&amp;rsquo;s limits. WCF was designed to shield the service author from any of the underlying transport details. It was also designed around an RPC style of communication, i.e. a Service operation corresponds to a method. Folks that are exposing services (Resources) over HTTP don&amp;rsquo;t want those details hidden, in fact they embrace them. HTTP is also not based on classes, types or methods, its based on resources and verbs. &lt;/p&gt;
&lt;p&gt;We want WCF to provide a natural experience which allows you to fully embrace HTTP within your development. We want to allow you to develop in a resource-oriented style. To that end we&amp;rsquo;re looking to extend WCF and introduce a set of client and server APIs completed based on HTTP. Those apis will enable building RESTful systems, or RESTful frameworks to build RESTful systems :-)&lt;/p&gt;
&lt;h1&gt;What about WCF Data Services?&lt;/h1&gt;
&lt;p&gt;WCF Data Services is designed to allows developers to expose entity data models using the OData protocol such that they can be queried and updated by OData clients. The work that we are doing with WCF WEB HTTP is to enable both clients to interact with arbitrary resources exposed over HTTP, as well as to enable exposing resources over HTTP in an arbitrary manner. It&amp;rsquo;s basically the &amp;ldquo;have it your own way&amp;rdquo; of HTTP. &lt;/p&gt;
&lt;h1&gt;We&amp;rsquo;re not the first to the party&lt;/h1&gt;
&lt;p&gt;Look across the .NET OSS community alone and you will see there&amp;rsquo;s a healthy ecosystem budding of frameworks like &lt;a href="http://trac.caffeine-it.com/openrasta/wiki/Doc"&gt;OpenRasta&lt;/a&gt;, &lt;a href="http://restsharp.org/"&gt;RestSharp&lt;/a&gt;, &lt;a href="http://hammock.codeplex.com/"&gt;Hammock&lt;/a&gt;. Glance into the Java, Ruby and Python worlds and you will see the same with frameworks like Restful Rails, &lt;a href="http://www.sinatrarb.com/"&gt;Sinatra&lt;/a&gt;, &lt;a href="http://www.restlet.org/"&gt;RESTlet&lt;/a&gt;, &lt;a href="http://restfulie.caelum.com.br/"&gt;RESTfulie&lt;/a&gt; (also in C#), and &lt;a href="https://jersey.dev.java.net/"&gt;Jersey&lt;/a&gt; to name a few. Oh and don&amp;rsquo;t forget &lt;a href="http://jquery.org/"&gt;JQuery&lt;/a&gt; and &lt;a href="http://www.sencha.com/products/js/"&gt;ExtJS&lt;/a&gt; :-) All this existing innovation is a great thing! It means we have a lot of existing mindshare we can pull from to ensure that whatever we deliver plays by the rules.&lt;/p&gt;
&lt;h1&gt;Two key goals: Simplicity and Testability.&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Less is more. We want to do less but make sure whatever we do is really easy to use (and really useful). &lt;/li&gt;
&lt;li&gt;Simple to test. Not technically feasible to test after you do a lot of work :-) &lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;We want your help&lt;/h1&gt;
&lt;p&gt;We&amp;rsquo;re not going about this alone:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We want you to help us get there. &lt;/li&gt;
&lt;li&gt;We want you to validate that what we&amp;rsquo;re building meets the needs and that we&amp;rsquo;re playing by the industry rules. &lt;/li&gt;
&lt;li&gt;We want you to tell us that what we&amp;rsquo;re building is right, rather than us telling you it will make your life better. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We&amp;rsquo;re still in the early phases of determining exactly what that means, but if you followed the way MEF was developed you can imagine ;-)&lt;/p&gt;
&lt;h1&gt;You don&amp;rsquo;t have to be using .NET or Microsoft technologies to help&lt;/h1&gt;
&lt;p&gt;If you are passionate in this space we&amp;rsquo;d welcome your involvement. I look forward to making this new journey with you. &lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10032702" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xhVmjPZUIb8:mnIon88uRNM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xhVmjPZUIb8:mnIon88uRNM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=xhVmjPZUIb8:mnIon88uRNM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xhVmjPZUIb8:mnIon88uRNM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xhVmjPZUIb8:mnIon88uRNM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=xhVmjPZUIb8:mnIon88uRNM:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=xhVmjPZUIb8:mnIon88uRNM:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/REST/">REST</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/06/30/resting-from-mef-or-the-mef-dealer-is-at-rest.aspx</feedburner:origLink></item><item><title>Way of MEF slides and Code</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/0BmdK1xq4CY/way-of-mef-slides-and-code.aspx</link><pubDate>Sun, 13 Jun 2010 07:11:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10024050</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10024050</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/06/13/way-of-mef-slides-and-code.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3782.image_5F00_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-73-92-metablogapi/3617.image_5F00_thumb_5F00_1.png" width="599" height="450" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Thanks to everyone who came out to the &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2010/06/03/mef-day-in-sf-the-way-of-mef-the-path-to-enlightenment.aspx"&gt;“Way of MEF”&lt;/a&gt; education day in Cupertino. I had a great time and you were an awesome audience. I really appreciate all the great / in-depth questions. It showed that you really were keeping along. I also enjoyed all the different side conversations, and all the times you guys overwhelmed me at the breaks. I really do love this stuff!&lt;/p&gt;  &lt;p&gt;Here is a link to get you access to the code and the slides: &lt;a title="http://cid-f8b2fd72406fb218.office.live.com/browse.aspx/Public/Way%20of%20MEF" href="http://cid-f8b2fd72406fb218.office.live.com/browse.aspx/Public/Way%20of%20MEF"&gt;http://cid-f8b2fd72406fb218.office.live.com/browse.aspx/Public/Way%20of%20MEF&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you download the code it contains the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;HelloMef_Simple - The simple widget example we built &lt;/li&gt;    &lt;li&gt;HelloMef_Extended - Sample that downloads multiple XAPs and which demonstrates ExportFactory. &lt;/li&gt;    &lt;li&gt;MefRules_Simple - The simple rules engine we built on the fly &lt;/li&gt;    &lt;li&gt;MefRules_Extended - More complete rules engine sample which uses rule metadata and contains a runner for Silverlight and Desktop. &lt;/li&gt;    &lt;li&gt;DynamicObjectContracts - Demonstrates a simple illustration of using dynamic exports and imports &lt;/li&gt;    &lt;li&gt;PartUpdatesInPlace - Demonstrates uses shadow copying to allow hot swapping / removing parts on the fly. (the one that the audience asked me about) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here are additional links:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Default exports: &lt;a href="http://blogs.msdn.com/b/gblock/archive/2009/05/14/customizing-container-behavior-part-2-of-n-defaults.aspx"&gt;http://blogs.msdn.com/b/gblock/archive/2009/05/14/customizing-container-behavior-part-2-of-n-defaults.aspx&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Filtered Catalogs: &lt;a href="http://mef.codeplex.com/wikipage?title=Filtering%20Catalogs&amp;amp;referringTitle=Guide"&gt;http://mef.codeplex.com/wikipage?title=Filtering%20Catalogs&amp;amp;referringTitle=Guide&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Config export provider: &lt;a href="http://codepaste.net/en44vo"&gt;http://codepaste.net/en44vo&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Ruby and MEF: &lt;a title="http://blogs.msdn.com/b/nblumhardt/archive/tags/ruby/" href="http://blogs.msdn.com/b/nblumhardt/archive/tags/ruby/"&gt;http://blogs.msdn.com/b/nblumhardt/archive/tags/ruby/&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;ASP.NET MVC and MEF: &lt;a title="MEF and ASP.NET MVC sample updated" href="http://blogs.msdn.com/b/hammett/archive/2009/07/15/mef-and-asp-net-mvc-sample-updated.aspx"&gt;MEF and ASP.NET MVC sample updated&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;ASP.NET Web Forms and MEF (doesn’t use CompositionInitializer approach): &lt;a title="WebForms and MEF Sample" href="http://mef.codeplex.com/releases/view/44166"&gt;WebForms and MEF Sample&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Diagnosing MEF - &lt;a title="http://blogs.msdn.com/b/nblumhardt/archive/2009/08/28/analyze-mef-assemblies-from-the-command-line.aspx" href="http://blogs.msdn.com/b/nblumhardt/archive/2009/08/28/analyze-mef-assemblies-from-the-command-line.aspx"&gt;http://blogs.msdn.com/b/nblumhardt/archive/2009/08/28/analyze-mef-assemblies-from-the-command-line.aspx&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Finally as promised, if you have questions that were not answered in the talk, feel free to comment here or email me direct and I will answer them in a follow up post.&lt;/p&gt;  &lt;p&gt;Thanks to &lt;a href="http://blog.brandewinder.com/"&gt;Mathias Brandewinder&lt;/a&gt;, &lt;a href="http://blog.brandewinder.com/"&gt;Kevin Rohling&lt;/a&gt;, his &lt;a href="http://orlandotechnuts.blogspot.com/"&gt;nutty&lt;/a&gt; girlfriend and recruiter extraordinaire Megan Hopkins and the Bay.NET UG for hosting me. I had an awesome time.&lt;/p&gt;  &lt;p&gt;Yes, I know I need to post on what I am working on now……I hear you, pleae be patient :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10024050" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=0BmdK1xq4CY:rYxc1uIazK0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=0BmdK1xq4CY:rYxc1uIazK0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=0BmdK1xq4CY:rYxc1uIazK0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=0BmdK1xq4CY:rYxc1uIazK0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=0BmdK1xq4CY:rYxc1uIazK0:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=0BmdK1xq4CY:rYxc1uIazK0:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=0BmdK1xq4CY:rYxc1uIazK0:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MEF/">MEF</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/06/13/way-of-mef-slides-and-code.aspx</feedburner:origLink></item><item><title>MEF day in SF, “The Way of MEF, the Path to Enlightenment”</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/ENxKlYyNO6o/mef-day-in-sf-the-way-of-mef-the-path-to-enlightenment.aspx</link><pubDate>Thu, 03 Jun 2010 08:08:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10019355</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10019355</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/06/03/mef-day-in-sf-the-way-of-mef-the-path-to-enlightenment.aspx#comments</comments><description>&lt;p&gt;&lt;img src="http://www.clear-lines.com/wiki/public/upload/misc/MEF-Fu.png" /&gt;&lt;/p&gt;  &lt;p&gt;On Saturday June 12th I am stoked to be coming to the SF bay area on behalf of the Bay.Net UG where I’ll be delivering a full day on MEF! &lt;/p&gt;  &lt;p&gt;We’re going to cover a world of topics as you can see from the list below.&lt;/p&gt;  &lt;p&gt;1. How to lazily instantiate parts to conserve processor cycles   &lt;br /&gt;2. Self-describing parts in order to allow more flexible discovery    &lt;br /&gt;3. Diagnosing common MEF failures    &lt;br /&gt;4. Adapting legacy components to work with MEF    &lt;br /&gt;5. Partitioning your Silverlight applications across multiple XAPs to reduce download cost and improve startup time    &lt;br /&gt;6. Providing default overridable parts    &lt;br /&gt;7. Using hierarchical containers for scoped composition    &lt;br /&gt;8. Creating custom catalogs to apply custom policy for filtering    &lt;br /&gt;9. Creating export providers to integrate with existing service providers    &lt;br /&gt;10. Composing UIs with MEF / MEF with Prism    &lt;br /&gt;11. Implementing MVVM with MEF&lt;/p&gt;  &lt;p&gt;The cost is $39.&amp;#160; Register &lt;a href="http://acteva.com/booking.cfm?bevaID=204633"&gt;here&lt;/a&gt; while there is still time!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10019355" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ENxKlYyNO6o:zeHK5nvGB7c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ENxKlYyNO6o:zeHK5nvGB7c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=ENxKlYyNO6o:zeHK5nvGB7c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ENxKlYyNO6o:zeHK5nvGB7c:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ENxKlYyNO6o:zeHK5nvGB7c:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=ENxKlYyNO6o:zeHK5nvGB7c:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=ENxKlYyNO6o:zeHK5nvGB7c:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MEF/">MEF</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/06/03/mef-day-in-sf-the-way-of-mef-the-path-to-enlightenment.aspx</feedburner:origLink></item><item><title>MEF has shipped!!!</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/zosJTLmC59U/mef-has-shipped.aspx</link><pubDate>Thu, 03 Jun 2010 01:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10019238</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=10019238</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/06/03/mef-has-shipped.aspx#comments</comments><description>&lt;p&gt;You might have missed it, but a few weeks ago &lt;strong&gt;MEF V1 shipped in &lt;/strong&gt;&lt;a href="http://www.microsoft.com/net/"&gt;&lt;strong&gt;.NET 4.0&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; and &lt;/strong&gt;&lt;a href="http://www.microsoft.com/silverlight/"&gt;&lt;strong&gt;Silverlight 4&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;! &lt;/strong&gt;As a team we&amp;rsquo;re really happy to have seen &lt;a href="http://msdn.microsoft.com/en-us/magazine/ee291628.aspx"&gt;MEF&lt;/a&gt; hit the wild. We believe MEF helps you to build better applications that are easier to extend. To get started with MEF, go visit our wiki &lt;a href="http://mef.codeplex.com/documentation"&gt;here&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;So far we&amp;rsquo;ve been hearing lots of goodness from customers that they feel the same. We&amp;rsquo;ve also been really happy seeing a healthy set of projects in the open source community pulling in MEF to address their extensibility challenges within their frameworks and applications. We&amp;rsquo;ve also had some interesting ports of MEF which is a great outcome of having an &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2008/10/02/mef-going-ms-pl-the-little-engine-that-could.aspx"&gt;OSS license&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;Below is a list of some of the folks internal and external to Microsoft that are using MEF along with the scenarios for which they use/support us (in a completely random order)&lt;/p&gt;
&lt;table cellpadding="2" cellspacing="0" border="1" style="width: 788px;"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="241" valign="top"&gt;&lt;a href="http://0.r.msn.com/?ld=2vWdp/GaoTcWGCboTNuq0bo4XjcXJ7/RfWEvJXU8ajAllNIiuXkyVDT8eP1FNjAmlEvsQ6wqAHfYQmFpWDNYmwvR1zvirHTWw9kiUCslzvyjguHWxVtcWB39hFG1BqB+GwfhCb1keiTmWMX2MSbeqF9M0wMNk2WrxB9/tXsx7rwXV/nyogowvImoWPy+W2WTBTbKe0XRadeyJMqPkUD3I4+8Az68zYkq7jnp0Nkk1rkmNgzdQ2kAK0oQx413XHXOQUJExd16ToAkakuCI9D6ZMyzkGoyaB/1q28EhPR7Lz98Qbxv8xdXk4Cw=="&gt;Visual Studio 2010&lt;/a&gt;&lt;/td&gt;
&lt;td width="545" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;New extensible editor &lt;/li&gt;
&lt;li&gt;Project system uses MEF under the covers &lt;/li&gt;
&lt;li&gt;VS Ultimate uses MEF for it&amp;rsquo;s UML designers &lt;/li&gt;
&lt;li&gt;Several other teams like EF use MEF for their designers &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="241" valign="top"&gt;&lt;a href="http://mefcontrib.codeplex.com"&gt;MEF Contrib&lt;/a&gt;&lt;/td&gt;
&lt;td width="545" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Community driven extensions to MEF &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="258" valign="top"&gt;&lt;a href="http://msaf.codeplex.com/"&gt;Silverlight Analytics Framework&lt;/a&gt;&lt;/td&gt;
&lt;td width="565" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Allows plugging in different analytic engines through MEF &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="264" valign="top"&gt;&lt;a href="http://smf.codeplex.com/"&gt;Silverlight Media Framework&lt;/a&gt;&lt;/td&gt;
&lt;td width="567" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Uses MEF for plugging in various extensions relating to the player &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="268" valign="top"&gt;&lt;a href="http://site.typemock.com/test-lint"&gt;TypeMock Test Lint&lt;/a&gt;&lt;/td&gt;
&lt;td width="565" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Uses MEF for allowing you to plug in your own custom rules &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="270" valign="top"&gt;&lt;a href="http://ravendb.net/"&gt;RavenDB&lt;/a&gt;&lt;/td&gt;
&lt;td width="563" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Uses MEF to allow plugging in triggers &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="272" valign="top"&gt;&lt;a href="http://caliburn.codeplex.com/"&gt;Caliburn&lt;/a&gt;&lt;/td&gt;
&lt;td width="562" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Supports plugging in MEF as a service provider &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="273" valign="top"&gt;&lt;a href="http://commonservicelocator.codeplex.com/"&gt;Common Service Locator&lt;/a&gt;&lt;/td&gt;
&lt;td width="561" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Provides an adapter for working with MEF &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="274" valign="top"&gt;&lt;a href="http://mefedmvvm.codeplex.com/"&gt;MefedMVVM&lt;/a&gt;&lt;/td&gt;
&lt;td width="560" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;MEF handles discovery and wire up of View Models both at runtime and design time &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="275" valign="top"&gt;&lt;a href="http://phpmef.codeplex.com/"&gt;PHPMEF&lt;/a&gt;&lt;/td&gt;
&lt;td width="560" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Yes, it&amp;rsquo;s possible, MEF for PHP :-) &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="275" valign="top"&gt;&lt;a href="http://pocketmef.codeplex.com/"&gt;PocketMEF&lt;/a&gt;&lt;/td&gt;
&lt;td width="560" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;MEF for PocketPC &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="275" valign="top"&gt;&lt;a href="http://www.mono-project.com/Main_Page"&gt;Mono&lt;/a&gt;&lt;/td&gt;
&lt;td width="560" valign="top"&gt;
&lt;ul&gt;
&lt;li&gt;Yes you heard it right, MEF 3.5 joins MVC2, System.Dynamic and OData client as part of the &lt;a href="http://www.mono-project.com/Release_Notes_Mono_2.8"&gt;mono&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;MEF V1 has been an awesome ride. The best part has been the fantastic &lt;a href="http://mef.codeplex.com/Thread/List.aspx"&gt;community&lt;/a&gt; that worked with us every step of the way giving us continual feedback and ensuring our success as well as our internal partners who pressed hard on us to keep us honest. Thank you for all your help and support!&lt;/p&gt;
&lt;p&gt;I also want to thank my team for the fantastic work they did. It was an amazing experience building MEF together!&lt;/p&gt;
&lt;p&gt;Sit tight, MEF v2 is on the way!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10019238" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zosJTLmC59U:N7dSs25xAGo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zosJTLmC59U:N7dSs25xAGo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=zosJTLmC59U:N7dSs25xAGo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zosJTLmC59U:N7dSs25xAGo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zosJTLmC59U:N7dSs25xAGo:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=zosJTLmC59U:N7dSs25xAGo:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=zosJTLmC59U:N7dSs25xAGo:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MEF/">MEF</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/06/03/mef-has-shipped.aspx</feedburner:origLink></item><item><title>Caveats about DeploymentCatalog</title><link>http://feedproxy.google.com/~r/MyTechnobabble/~3/KMSlTUotljw/caveats-about-deploymentcatalog.aspx</link><pubDate>Tue, 13 Apr 2010 20:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9995416</guid><dc:creator>Glenn Block MSFT</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.msdn.com/b/gblock/rsscomments.aspx?WeblogPostID=9995416</wfw:commentRss><comments>http://blogs.msdn.com/b/gblock/archive/2010/04/13/caveats-about-deploymentcatalog.aspx#comments</comments><description>&lt;P&gt;The information below was wrapped up in my previous post on DeploymentCatalog. As a bunch of folks have been asking questions on this, it seems worth to rip out on it's own.&lt;/P&gt;
&lt;H1&gt;A few caveats about DeploymentCatalog.&lt;/H1&gt;
&lt;P&gt;DeploymentCatalog is a very exciting addition to the MEF box. There are a few caveats to it’s usage.&lt;/P&gt;
&lt;UL done1="370" done2="370"&gt;
&lt;LI done1="371" done2="371"&gt;Does not support Silverlight cached assemblies. (Otherwise known as TPEs). This means that DC will not download referenced assemblies that are packaged with the Silverlight caching infrastructure (.extmap). 
&lt;UL done1="372" done2="372"&gt;
&lt;LI&gt;This includes cached assemblies in the main xap. 
&lt;LI&gt;If the cached assemblies are referenced by the main app, they will be available to the assemblies in a downloaded XAP. 
&lt;LI&gt;You can create shared xaps which contain assemblies to be used by other xaps and download those with the DeploymentCatalog. As long as the shared xaps are downloaded first they will be available to others. 
&lt;LI&gt;If you do decide to use either of the previous approaches, be sure to set your references to “Copy Local = False” in your XAPs otherwise you will be embedding the shared assemblies again.Does not support localization. 
&lt;LI&gt;We are looking into cached assembly support in the future. &lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Does not support non-embedded resources. 
&lt;LI&gt;Local resource references in XAML also are not supported i.e. using pack URIs. You can programatically access embedded resources though. &lt;/LI&gt;&lt;/UL&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9995416" width="1" height="1"&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=KMSlTUotljw:QuJLlu5es5M:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=KMSlTUotljw:QuJLlu5es5M:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=KMSlTUotljw:QuJLlu5es5M:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=KMSlTUotljw:QuJLlu5es5M:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=KMSlTUotljw:QuJLlu5es5M:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/MyTechnobabble?a=KMSlTUotljw:QuJLlu5es5M:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/MyTechnobabble?i=KMSlTUotljw:QuJLlu5es5M:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description><category domain="http://blogs.msdn.com/b/gblock/archive/tags/MEF/">MEF</category><category domain="http://blogs.msdn.com/b/gblock/archive/tags/SL4/">SL4</category><feedburner:origLink>http://blogs.msdn.com/b/gblock/archive/2010/04/13/caveats-about-deploymentcatalog.aspx</feedburner:origLink></item></channel></rss>

