<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Lee Richardson - Blogs at Near Infinity</title>
    <link>http://www.nearinfinity.com/blogs/lee_richardson</link>
    <description>Lee Richardson's Blogs</description>
    <language>en-us</language>
    <copyright>Copyright 2013</copyright>
    <lastBuildDate>Tue, 21 May 2013 03:00:20 -0400</lastBuildDate>
    <docs>http://www.rssboard.org/rss-specification</docs>
    
      <item>
        <title>USB Device Not Recognized in USB 3.0</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/2013/03/01/USB-Device-Not-Recognized-for-USB-3.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/2013/03/01/USB-Device-Not-Recognized-for-USB-3.html</guid>
        <pubDate>Fri, 01 Mar 2013 00:00:00 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;
Unless you're having this problem:&lt;p&gt;

&lt;a href=&quot;http://3.bp.blogspot.com/-DK7_j5_MpsM/UTDJpfERtAI/AAAAAAAACUE/5xP2JDyM5xA/s1600/USB-device-not-recognized.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; style=&quot;margin-left: 0px;&quot; src=&quot;http://3.bp.blogspot.com/-DK7_j5_MpsM/UTDJpfERtAI/AAAAAAAACUE/5xP2JDyM5xA/s320/USB-device-not-recognized.png&quot; /&gt;&lt;/a&gt;

&lt;p&gt;
For USB 3.0 ports on an Arduino-like stack you may safely stop reading.  Nothing to see here just trying to fill out the Internet.&lt;/p&gt;

&lt;h2&gt;
The Problem&lt;/h2&gt;

&lt;p&gt;
This problem occurred for me on an ATMEL ATMEGA32U2 chip with the &lt;a href=&quot;https://code.google.com/p/lufa-lib/&quot;&gt;LUFA USB framework for AVRs&lt;/a&gt; and the HID USB driver.  Everything worked fine for USB 2.0, but on modern PC's it would pop up &quot;USB device not recognized&quot;.&lt;/p&gt;

&lt;p&gt;
In device manager the device showed up as Unknown device.  Device status would look like this:&lt;/p&gt;

&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
Windows has stopped this device because it has reported problems. (Code 43)&lt;/blockquote&gt;

&lt;p&gt;
And in the event viewer it showed something like this:&lt;/p&gt;

&lt;pre&gt;
&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
Device USB\VID_0000&amp;PID_0002\5&amp;ea89d57&amp;0&amp;2 had a problem starting.

Driver Name: null
Class GUID: {00000000-0000-0000-0000-000000000000}
Service: 
Lower Filters: 
Upper Filters: 
Problem: 0x2B
Status: 0x0&lt;/blockquote&gt;&lt;/pre&gt;

&lt;h2&gt;
The Solution&lt;/h2&gt;

&lt;p&gt;
Despite a lot of fruitless packet monitoring and upgrading various packages and help from master-hacker &lt;a href=&quot;http://twitter.com/joeferner&quot;&gt;Joe Ferner&lt;/a&gt;, solving this ultimately boiled down to compiling the GenericHid sample project from LUFA (which did work in USB 3.0) and then commenting out more and more of my project until it worked and then incrementally adding everything back via binary search.&lt;/p&gt;

&lt;p&gt;
The problem ended up being the amount of time that passed between the call to LUFA's&lt;/p&gt;

&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
USB_Init();&lt;/blockquote&gt;

&lt;p&gt;
And the USB calls in the main program loop.  So essentially I was doing something like this:&lt;/p&gt;

&lt;pre style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
&lt;code&gt;
int main(void);

&amp;nbsp;&amp;nbsp;MCUSR &amp;= ~(1 &lt;&lt; WDRF);

&amp;nbsp;&amp;nbsp;wdt_disable();

&amp;nbsp;&amp;nbsp;clock_prescale_set(clock_div_1);

&amp;nbsp;&amp;nbsp;USB_Init();

&amp;nbsp;&amp;nbsp;_delay_ms(500); // &amp;lt;- DON'T DO THIS

&amp;nbsp;&amp;nbsp;for (;;)

&amp;nbsp;&amp;nbsp;{

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;HID_Device_USBTask(&amp;Generic_HID_Interface);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;USB_USBTask();

&amp;nbsp;&amp;nbsp;}

}&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;
Take that delay out and everything works.&lt;/p&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;
The takeaway: move all of your initialization logic - anything that might take any time at all - prior to the USB_Init call.  It might just save you a lot of pain down the road.  That's it.  Hope this helps someone, somewhere.&lt;/p&gt;
 </description>
        
          <category term="arduino" label="arduino"/>
        
      </item>
    
      <item>
        <title>Google Play vs Windows Store: A Stark Contrast</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/2013/01/22/google-play-vs-windows-store-a-stark-contrast.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/2013/01/22/google-play-vs-windows-store-a-stark-contrast.html</guid>
        <pubDate>Tue, 22 Jan 2013 00:00:00 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;It's a familiar story: anything-goes-wild-west vs bureaucracy-ridden-walled garden. But you probably already knew that. What surprised me is how incredibly stark the contrast is.&lt;/p&gt;
&lt;p&gt;Getting an app in Android and on Windows 8 couldn't be more different: from fees, to technical support, to the app-submission process.&lt;/p&gt;
&lt;center&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-ImUGQb3tmJc/UP7EPAjFVQI/AAAAAAAACTw/HMsi_ib6eyY/s1600/wild-west-vs-walled-garden.png&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; width=&quot;400&quot; src=&quot;http://2.bp.blogspot.com/-ImUGQb3tmJc/UP7EPAjFVQI/AAAAAAAACTw/HMsi_ib6eyY/s400/wild-west-vs-walled-garden.png&quot; /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;
&lt;h1&gt;Setup for the Letdown&lt;/h1&gt;
&lt;p&gt;You'd think an app store coming from behind might try to get their app count up by accepting new submissions first and asking questions later. Couldn't be further from the truth. &lt;/p&gt;
&lt;p&gt;My first Windows Store app took a total of 33 days from the first time I tried to submit through when it was finally accepted. My Google Play app? 4 days.&lt;/p&gt;
&lt;p&gt;Let's be honest, 33 days is completely unacceptable. Why so long? Partly it's because they have standards. No really. Believe it or not they have live human beings manually test your app and provide a write-up of why it wasn't good enough for their marketplace. It's sort of like getting a free tester.&lt;/p&gt;
&lt;p&gt;This approach actually makes sense for them. Classic Windows is similar to what Android is today. You can pretty much install anything from any random website. Google just centralizes their chaos. The result for classic Windows? Malware, Trojan viruses, countless unwanted browser plug-ins, and a slowly degrading computer experience over time as more crap gets installed. In short: a lack of trust in apps. If Microsoft allowed everything in they would be right back to the problem they had in the first place.&lt;/p&gt;
&lt;p&gt;But 33 days? Really!? &lt;/p&gt;
&lt;p&gt;In my case my first rejection actually came in just 3 days. It was a couple of minor issues. The app needed a privacy policy and apparently also a link to create a new account rather than just a log in screen (even though you could do some stuff without logging in). That second item was an excellent point I'd never even thought of. I'd incorrectly assumed most of my app users would be existing website users. There was a brief mention of what to do, but no link or in-app account creation. &lt;/p&gt;
&lt;p&gt;My previously submitted Google Play app had these problems too, but they certainly didn't have human beings considering how users will interact with my app. Go manual testing! Go Microsoft!&lt;/p&gt;
&lt;p&gt;But my initial excitement was just a set up for a big letdown. I resubmitted within a day and then waited. &lt;/p&gt;
&lt;p&gt;And waited. &lt;/p&gt;
&lt;p&gt;And waited.&lt;/p&gt;
&lt;h1&gt;Customer Support: Microsoft++&lt;/h1&gt;
&lt;p&gt;How a company responds to problems can be more insightful than the fact that they have them. After all everyone screws up at some point, right?&lt;/p&gt;
&lt;p&gt;The following was one of several interactions I had with Microsoft support. &lt;/p&gt;
&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
    Dear Andy,&lt;br /&gt;
    &lt;br /&gt;
 It has now been 22 days since I resubmitted my app.  It has been almost a month since my initial submission.  It has been three days since you estimated it would be a day or two.
    &lt;br /&gt;
    &lt;br /&gt;
    Is this going anywhere?  Am I being quietly ignored for some reason?  If there are reasons my app is being ignored could you please list them so that I could resolve the issues?  Or if Microsoft simply does not want me developing apps for Windows 8 is there a facility for me to get my money back?
    &lt;br /&gt;
    &lt;br /&gt;
    I am extremely frustrated by this process.  If I were ever to get my app in the store and needed to get an update out quickly, might it take as long as the initial submission has been?  Because a month turn-around to fix bugs is completely unacceptable: not just to me, but to every single user of the Windows Store.
    &lt;br /&gt;
    &lt;br /&gt;
    I genuinely want Microsoft to succeed and will do what I can to help, but if this is how it's treating its developers, customers, and supporters then I'm sorry to say my expectations are low.
    &lt;br /&gt;
    &lt;br /&gt;
    Sincerely,
    &lt;br /&gt;
    - Lee
&lt;/blockquote&gt;
&lt;p&gt;A bit too strong? I was getting angry. To date I had been at least impressed with their professional and quick responses. &lt;/p&gt;
&lt;p&gt;However I was floored by their response to my angry e-mail.&lt;/p&gt;
&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
    Hi Lee,
    &lt;br /&gt;
    &lt;br /&gt;
    Thank you for using the Microsoft Windows Store.
    &lt;br /&gt;
    &lt;br /&gt;
    Thank you for getting back to me. I have been checking your account on a daily basis to see if your app has been passed. I can tell you I am looking into this issue for you. I haven't ignored you at all. On the contrary I am eager to help you get this issue resolved.
    &lt;br /&gt;
    &lt;br /&gt;
    I understand that it is really frustrating for you and I am doing everything I can to have this issue resolved for you. I hope to have an answer for you soon. Again I am sorry that it is taking so long to get through the process.
    &lt;br /&gt;
    &lt;br /&gt;
    If you have any more questions please reply and I will be happy to help you.
    &lt;br /&gt;
    &lt;br /&gt;
    Thank you
    &lt;br /&gt;
    Andy
    &lt;br /&gt;
    Your Partner at Microsoft
    &lt;br /&gt;
    Use what you know. Do what you've always imagine&lt;/blockquote&gt;
&lt;p&gt;I don't know about you, but I think sincere compassion is something I'm secretly hoping for in every customer service interaction. If I could just get a quick resolution to the problem I'd still give Microsoft a big win in my book. Sadly that wasn't to be.&lt;/p&gt;
&lt;p&gt;By way of comparison Google had issues with my initial Google Play submission too. It gave me a nice opportunity to compare how the companies responded to adversity.&lt;/p&gt;
&lt;p&gt;When Google accepted my money but wouldn't let me submit my app I got a response like this:&lt;/p&gt;
&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
    Hi Lee,&lt;br /&gt;&lt;br /&gt;
    Thank you for your note. We apologize for the delay in your account registration. We have activated your account and you may begin uploading applications. Thank you for your interest in Google Play.&lt;br /&gt;&lt;br /&gt;
    If we can assist you further, please let us know.&lt;br /&gt;&lt;br /&gt;
    Regards,&lt;br /&gt;
    The Google Play Team
&lt;/blockquote&gt;
&lt;p&gt;Not bad. But not compassionate. No name of a person who wrote the note, no &quot;it must be frustrating&quot;. &lt;/p&gt;
&lt;p&gt;But whatever. It was a relatively quick resolution from Google. Two days to respond to me for a total of 4 days from time of initial submission until final app acceptance. I'll take an emotionless quick resolution over a drawn-out unresolved empathetic one any day.&lt;/p&gt;
&lt;h1&gt;Fees: Google FTW&lt;/h1&gt;
&lt;p&gt;As a quick aside do you know how much it costs to get an app on Android? It's $25 &quot;once and only once. Just enough to keep the riffraff out. And Windows 8? $50&quot; every .. single .. year.&lt;/p&gt;
&lt;p&gt;Why should I have to pay another $50 fee next year just for the privilege of making a quick update to my free, no-advertisements, non-revenue generating app? &lt;/p&gt;
&lt;p&gt;The chances are good I won't be renewing that fee. The chances are good a lot of developers won't. And that will lead to stale apps and a bad customer experience. Poorly done Microsoft. #win8 #fail.&lt;/p&gt;
&lt;h1&gt;Fail, Fail, and More Fail&lt;/h1&gt;
&lt;p&gt;So how does the Windows Store story end? 25 days from my initial submission I got this response:&lt;/p&gt;
&lt;blockquote style=&quot;background: #F5F5F5; padding: 5px; margin-left: 40px;&quot;&gt;
    Notes from Testers:&lt;br /&gt;&lt;br /&gt;
    .D:: This app appears to be incomplete in its functionality to our reviewers. The app appears to have dependencies on non-Windows Store style APIs. In the app description as well as in the app, the users are asked to download additional software to be functional.
&lt;/blockquote&gt;
&lt;p&gt;Rejected. Again. This time for a different reason. In their defense I should have read their submission guidelines. But couldn't they have told me this during the first rejection? Did it really require 25 days for &lt;em&gt;this&lt;/em&gt; response?&lt;/p&gt;
&lt;p&gt;I was crushed. They were asking for a massive rearchitecting that didn't make sense and maybe wasn't even possible. Google Play was beginning to look golden.&lt;/p&gt;
&lt;p&gt;The problem was in how my app works. It shows the realtime status of a continuous integration server, but requires a desktop app to collect the data and upload it to &quot;the cloud&quot;. The mobile app just gives a view into the cloud data and receives push notifications and live tile updates from a server. Seems reasonable right? Apparently &lt;i style=&quot;font-style:italic&quot;&gt;the entire architecture violates Microsoft's submission guidelines&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;My plan involved adding a single CI server that didn't require a desktop app to sneak by their policies while leaving the existing process all other CI servers. I'd use Travis, since it's guaranteed to never be behind a firewall. I had a low confidence the plan would work.&lt;/p&gt;
&lt;p&gt;After a week of evenings followed by an all-nighter I resubmitted at 5 am EST (I'm a sick puppy, I know) and crossed my fingers that it wouldn't be another 22 days.&lt;/p&gt;
&lt;p&gt;3.5 hours later, at 8:30 am, I got an e-mail from Microsoft. With that kind of turn-around it couldn't be good news.&lt;/p&gt;
&lt;p&gt;It was. It passed. I was shocked. &lt;/p&gt;
&lt;p&gt;They couldn't have run the automated tests in that amount of time let alone manually tested it. And what humans do business at like 7 am EST? Did they just take pity on me? Did Andy, my compassionate customer support representative come through for me? I still don't know.&lt;/p&gt;
&lt;h1&gt;Updates&lt;/h1&gt;
&lt;p&gt;One final comparison. Updates on the Windows Store seem to take around 8 hours. On Google Play they're seemingly instantaneous. In both stores customers have an update to install by the next day. No complaints there.&lt;/p&gt;
&lt;h1&gt;Summary&lt;/h1&gt;
&lt;p&gt;So who has the better process? Google. Hands down. They allow for a lean, minimum viable product style of development. Publish early and often, get feedback quickly, push the features your customers really want.&lt;/p&gt;
&lt;p&gt;But I like elements of the Windows Store process. Friendly customer support people rock. Manual testing made my app better. But were their &quot;improvements&quot; the kinds of things real customers would prioritize highly? Maybe, maybe not.&lt;/p&gt;
&lt;p&gt;I guess my ideal app store would cost $25 once; incorporate a manual tester that provides helpful suggestions not requirements; reject apps rarely if ever; give empathetic responses &lt;i style=&quot;font-style:italic&quot;&gt;and&lt;/i&gt; quick resolutions when problems do happen; oh and turn submissions around in 3.5 hours or less every time.&lt;/p&gt;
&lt;div style='float:right;padding:4px; text-align: center; width: 115px;'&gt;
&lt;a class='twitter-share-button' data-count='horizontal' data-lang='en' data-related='lprichar:Lee Richardson Blog' data-text='RT @lprichar ' data-url='http://rapidapplicationdevelopment.blogspot.com/2013/01/google-play-vs-windows-store-stark.html' data-via='' href='http://twitter.com/share' rel='nofollow'&gt;&lt;/a&gt;
&lt;script type='text/javascript'&gt;
    var currentPageUrl = 'http://www.nearinfinity.com/blogs/lee_richardson/2013/01/22/google-play-vs-windows-store-a-stark-contrast.html';

    /* DotNetKicks */
    var dotnetkicksLink = document.createElement('a');
    dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
    var dotnetkicksImg = document.createElement('img');
    dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
    dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
    dotnetkicksImg.setAttribute('border', '0');
    dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
    dotnetkicksLink.appendChild(dotnetkicksImg);

    var div = document.createElement('div');
    div.appendChild(document.createElement('br'));
    div.appendChild(dotnetkicksLink);
    document.write(div.innerHTML);
    &lt;/script&gt;
&lt;p&gt;&lt;/p&gt;
&lt;script src='http://platform.twitter.com/widgets.js' type='text/javascript'&gt;
&lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;That's not too much to ask for, is it?&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p style=&quot;background: #F5F5F5; padding: 4px;&quot;&gt;&lt;i style=&quot;font-style:italic&quot;&gt;Lee Richardson has been developing applications for public and private sector clients in the Washington DC area for over fourteen years.  You can follow him on twitter &lt;a href=&quot;http://twitter.com/lprichar&quot;&gt;@lprichar&lt;/a&gt;.&lt;/i&gt;&lt;/p&gt;
</description>
        
          <category term="mobile," label="mobile,"/>
        
          <category term="android," label="android,"/>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>How To Get The Most From Twitter: Scoping Rules</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/how_to_get_the_most_from_twitt.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/how_to_get_the_most_from_twitt.html</guid>
        <pubDate>Tue, 29 Nov 2011 10:36:04 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description> &lt;p&gt;Ever noticed a tweet disappear? As in someone else can't see something you posted?  There's a common mistake even twitter pros make that causes this to occur.&lt;/p&gt;
&lt;p&gt;Are you sure you're seeing &lt;i&gt;all&lt;/i&gt; of the replies to your tweets -- even from people you don't follow?  Do you ever find yourself missing important posts -- like those from your real life friends?  Do you know which will reach a wider audience: new style retweets vs old style retweets?&lt;/p&gt;
&lt;p&gt;This article will answer these and other twitter related questions. It will help beginner to intermediate twitter users get the most out of the service.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;#1 Standard #Tweets&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-e8CL3yKse4c/TtRbWzwGNlI/AAAAAAAAByI/lB9vEdwttes/s1600/1.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 349px; height: 343px;&quot; src=&quot;http://4.bp.blogspot.com/-e8CL3yKse4c/TtRbWzwGNlI/AAAAAAAAByI/lB9vEdwttes/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5680265477428229714&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;These appear simple.  These show up in the timeline of your followers (@admirer and @vet in the example above).  And they don't show up in the timeline of anyone who doesn't follow you (@effusive).  If this was all there was to twitter it would be a complete waste of time.&lt;/p&gt;
&lt;p&gt;The subtlety with this type of tweet is that your content may show up to someone that doesn't follow you but that is following a hashtag or a topic you mention.  In the example above @hiro thows a hashtag onto the word aardvarks to indicate that it's special somehow.  His tweet is then picked up by @spca who runs a constant search in a twitter client for the word &quot;#aardvark&quot;.&lt;/p&gt;
&lt;p&gt;The first time I realized how powerful this could be I had was at a conference.  I was extremely bored by a terrible keynote.  With nothing else to do I discovered the conference hashtag on twitter and started watching it.  Suddenly I realized I wasn't alone.  I was in a huge room full of people making fun of the presenter!  It was like telepathy, or group consciousness or something.  I've never felt alone or bored at a conference since.&lt;/p&gt;
&lt;p&gt;Interesting statistic: As of June 2010, about 65 million tweets were posted each day, equaling about 750 tweets sent each second. (&lt;a href=&quot;http://en.wikipedia.org/wiki/Twitter&quot;&gt;reference&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#2 Replies&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-yg6C6yTNlfo/TtRbXFuUjsI/AAAAAAAAByU/Si6sfvHr-9c/s1600/2.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 317px;&quot; src=&quot;http://3.bp.blogspot.com/-yg6C6yTNlfo/TtRbXFuUjsI/AAAAAAAAByU/Si6sfvHr-9c/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;Img1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Replies are more complicated.  In the example above the guy on the left, @vet, replies to @hiro by prefixing his tweet with &quot;@hiro&quot;.  However, this probably doesn't work like you think.  The tweet obviously shows up in @hiro's timeline, but it also shows up in @admirer's timeline because she follows both people mentioned in the tweet (@hiro &lt;i&gt;and&lt;/i&gt; @vet).  But the tweet does &lt;i&gt;not&lt;/i&gt; show up to @effusive because, while he follows @vet, the author of the tweet, he doesn't follow @hiro, the person being mentioned.&lt;/p&gt;
&lt;p&gt;Getting this scoping rule wrong is way too easy.  For instance you can't just announce that someone did something great.  If @hiro started a tweet with &quot;@vet gave a great anti-aardvark presentation&quot; then most of his followers (e.g. @effusive) wouldn't actually see the tweet!  I've seen seasoned twitter users make this mistake.&lt;/p&gt;
&lt;p&gt;As an interesting aside twitter can help track conversations.  If you click a reply button in a twitter client or on the website twitter will keep track of which tweet you replied to and then help piece a conversation together.  But if you simply start a new tweet with &quot;@somone&quot; without clicking reply, the above scoping rules still apply, but twitter won't help anyone reconstruct the conversation.&lt;/p&gt;
&lt;p&gt;Finally a word on notifications: If someone mentions you (via a reply or anywhere in their tweet) and you follow them then you will get an e-mail and possibly an SMS notification.  If someone that you do not follow replies to you, you &lt;i&gt;will not&lt;/i&gt; get an email.  For this reason you must either frequently check the &quot;mentions and more&quot; section of the website or use a column based twitter client, discussed in the final section on lists.&lt;/p&gt;
&lt;p&gt;Interesting statistic: On average only 23% of tweets get a reply. (&lt;a href=&quot;http://www.sysomos.com/insidetwitter/engagement/&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Another one: 38% of tweets are conversational.  In other words 38% of tweets start with an &quot;@&quot;. If your percentage of replies is lower you probably aren't using twitter to its fullest. (&lt;a href=&quot;http://www.pearanalytics.com/blog/wp-content/uploads/2010/05/Twitter-Study-August-2009.pdf&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#3 Reply-All's&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-VBvIcRq5ANk/TtRbXahnI2I/AAAAAAAAByc/U1KHy4J3x0Q/s1600/3.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 379px; height: 333px;&quot; src=&quot;http://3.bp.blogspot.com/-VBvIcRq5ANk/TtRbXahnI2I/AAAAAAAAByc/U1KHy4J3x0Q/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;Img2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So what happens if you want to reply to someone, but still have it show up in the timelines of &lt;i&gt;all&lt;/i&gt; of your followers?  As long as your tweet doesn't start with an &quot;@&quot; symbol then you're fine.  So the convention that has grown up is to prefix your tweet with a &quot;.&quot; and then the &quot;@someone&quot;.  In the example above @effusive now sees the tweet where he didn't in a standard reply.&lt;/p&gt;
&lt;p&gt;Interesting statistic: The highest usage rate of twitter to date occurred during the 2011 FIFA Women's World Cup Final between Japan and the United States when 7,196 tweets were published per second! (&lt;a href=&quot;http://www.usatoday.com/tech/news/2011-07-18-world-cup-twitter-record_n.htm&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#4 Old Style Retweet or &quot;Retweet with Comment&quot;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-T2Z7KRpWud8/TtRbXh_DKuI/AAAAAAAABys/EHV8GHZIRrE/s1600/4.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 282px;&quot; src=&quot;http://4.bp.blogspot.com/-T2Z7KRpWud8/TtRbXh_DKuI/AAAAAAAABys/EHV8GHZIRrE/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5680265489838975714&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Prior to late 2009 if you saw a tweet you wanted to share with your followers you would retweet (RT) it by copy and pasting their tweet and prefixing it with &quot;RT @author&quot;.  The problem from a scoping perspective was that people would get duplicates.  In the example above @admirer sees a duplicate from @vet when he retweets @hiro's tweet.&lt;/p&gt;
&lt;p&gt;There are other problems with old style retweets unrelated to scoping.  One problem is that you get long chains of &quot;RT @person1 RT @person2 ...&quot;.  Another problem is it was hard to follow a person but not all their retweets.  The biggest problem is old style retweets take valuable characters away from your available 140, and sometimes require mangling the original.&lt;/p&gt;
&lt;p&gt;Old style retweeting is still in use today primarily from people wish to retweet but add a comment, but also because it allows people to reach a wider audience (since new style retweets won't show up in searches or lists, more on this later).&lt;/p&gt;
&lt;p&gt;Interesting statistic: Only 6% of tweets get retweeted (&lt;a href=&quot;http://socialtimes.com/report-71-percent-of-tweets-do-not-get-a-single-reply-or-retweet_b24365&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#5 New Style Retweet&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-OfR_u71pkK8/TtRbYFzvYkI/AAAAAAAABy4/n_JlWBmX-3Q/s1600/5.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 338px;&quot; src=&quot;http://2.bp.blogspot.com/-OfR_u71pkK8/TtRbYFzvYkI/AAAAAAAABy4/n_JlWBmX-3Q/s400/5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5680265499455218242&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In November of 2009 twitter rolled out a new technique for retweeting aimed at solving the problems mentioned above.  It caused a lot of confusion, but did solve the problems.&lt;/p&gt;
&lt;p&gt;The end result of new style retweets from a scoping perspective is that sometimes people see tweets from people they don't follow.  In the example above @effusive sees @hiro's tweet in his timeline even though he doesn't follow @hiro, because @vet performed a new-style retweet.&lt;/p&gt;
&lt;p&gt;If you click the retweet button on the twitter website today it will perform a new style retweet.  Some twitter clients like TweetDeck give you the option.  The only way to perform an old style retweet or retweet with comment via the website is to copy and paste the message.&lt;/p&gt;
&lt;p&gt;Interesting statistic: Less than half of tweets are posted using the web user interface.  By far the most common twitter client is Tweetdeck with 8.48% of the market. (&lt;a href=&quot;http://www.sysomos.com/insidetwitter/clients/&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#6 Direct Messages&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-hTvmYv4PA7k/TtRcUt8ld_I/AAAAAAAABzE/7gD3kRqy8Rc/s1600/6.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 276px;&quot; src=&quot;http://2.bp.blogspot.com/-hTvmYv4PA7k/TtRcUt8ld_I/AAAAAAAABzE/7gD3kRqy8Rc/s400/6.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;Img4&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Direct messages are simple.  Prefix your tweet with &quot;D somone&quot; (no at symbol before the name) and they will be the only person that will see it.  Just like e-mail except the recipient will get an e-mail and a text message if they've set that up on their phone.  Note that neither people watching an included hashtag  (e.g. @spca) nor people mentioned will see direct messages unless they are the recipient.&lt;/p&gt;
&lt;p&gt;Interesting statistic: Six percent of all tweets are sent via SMS. (&lt;a href=&quot;http://www.quora.com/What-percentage-of-Twitter-users-get-their-Twitter-updates-predominately-from-direct-text-messages-as-opposed-to-the-website-or-3rd-party-Apps&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;#7 Lists&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The last scoping topic worthy of mention is lists.  This fantastic feature was added by twitter in late 2009.  It allows you to organize the people you follow.  For instance I have a private &quot;Infrequent Posters&quot; list that I try very hard to never miss a tweet from.  Meanwhile I follow enough people that my main list is more like a stream that I dip into but don't get stressed out if I miss some of.&lt;/p&gt;
&lt;p&gt;Lists work best when used in conjunction with a column based twitter clients (e.g. TweetDeck).  These types of twitter clients are the only way to go if you want to become a twitter pro.  If you've gotten to the point where you start missing content from important people (e.g. your real life friends), or you're missing responses to your tweets, or mentions from people you don't follow: then you probably need lists, but you absolutely need something like TweetDeck.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-xyrC1APLTqM/TtRcU6p58_I/AAAAAAAABzQ/cUvaNcE8_zk/s1600/7.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 368px; height: 321px;&quot; src=&quot;http://3.bp.blogspot.com/-xyrC1APLTqM/TtRcU6p58_I/AAAAAAAABzQ/cUvaNcE8_zk/s400/7.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;Img3&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In regards to scoping, lists contain one subtlety that you need to be aware of.  They do not support new style retweets.  In the example above @vet posts a normal tweet.  He then new-style retweets one of @hiro's tweets.  @effusive follows @vet and has also placed him into a list.  While the list helps @effusive not miss tweets from @vet, it does not end up displaying @hiro's tweet.  &lt;/p&gt;
&lt;p&gt;Note that this rule applies both to people who maintain their own lists as well as to people who follow lists maintained by other people (e.g. your company may maintain a public list of its twitter enabled employees).&lt;/p&gt;
&lt;p&gt;Interesting Statistic: Pointless babble is the most common type of content on twitter.  It represents 40.55% of all traffic. (&lt;a href=&quot;http://www.pearanalytics.com/blog/wp-content/uploads/2010/05/Twitter-Study-August-2009.pdf&quot;&gt;more&lt;/a&gt;)&lt;/p&gt;


&lt;div style=&quot;float:right;padding:4px; text-align: center; width: 115px;&quot;&gt;
&lt;iframe src=&quot;http://platform.twitter.com/widgets/tweet_button.html#_=1322581831960&amp;amp;count=horizontal&amp;amp;id=twitter_tweet_button_0&amp;amp;lang=en&amp;amp;original_referer=http%3A%2F%2Frapidapplicationdevelopment.blogspot.com%2F2011%2F11%2Fhow-to-get-most-from-twitter.html&amp;amp;related=lprichar%3ALee%20Richardson%20Blog&amp;amp;text=RT%20%40lprichar%20How%20To%20Get%20The%20Most%20From%20Twitter%3A%20Understand%20Scoping%20Rules&amp;amp;url=http%3A%2F%2Frapidapplicationdevelopment.blogspot.com%2F2011%2F11%2Fhow-to-get-most-from-twitter.html&quot; allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; class=&quot;twitter-share-button twitter-count-horizontal&quot; style=&quot;width: 110px; height: 20px; &quot; title=&quot;Twitter For Websites: Tweet Button&quot;&gt;&lt;/iframe&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2011/11/how-to-get-most-from-twitter.html';

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div id=&quot;___plusone_0&quot; style=&quot;height: 20px; width: 90px; display: inline-block; text-indent: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; hspace=&quot;0&quot; id=&quot;I1_1322581832741&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;I1_1322581832741&quot; scrolling=&quot;no&quot; src=&quot;https://plusone.google.com/_/+1/fastbutton?url=http%3A%2F%2Frapidapplicationdevelopment.blogspot.com%2F2011%2F11%2Fhow-to-get-most-from-twitter.html&amp;amp;size=medium&amp;amp;count=true&amp;amp;annotation=bubble&amp;amp;hl=en-US&amp;amp;jsh=m%3B%2F_%2Fapps-static%2F_%2Fjs%2Fwidget%2F__features__%2Frt%3Dj%2Fver%3DJJ_UMfXdHS0.en_US.%2Fsv%3D1%2Fam%3D!7cXxqVkrvlyIEO88iA%2Fd%3D1%2F#id=I1_1322581832741&amp;amp;parent=http%3A%2F%2Frapidapplicationdevelopment.blogspot.com&amp;amp;rpctoken=152461457&amp;amp;_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe&quot; style=&quot;width: 90px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; height: 20px; position: static; left: 0px; top: 0px; visibility: visible; &quot; tabindex=&quot;-1&quot; vspace=&quot;0&quot; width=&quot;100%&quot; title=&quot;+1&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;script src=&quot;http://platform.twitter.com/widgets.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Twitter may appear to be fairly simple at first glance.  In reality it has grown over the years to become very sophisticated.  Sophisticated and incredibly powerful.  But to fully tap that power you must understand the scoping rules and subtleties surrounding things like replies, retweets, and lists.  Hopefully you're closer now.&lt;/p&gt;
 
</description>
        
          <category term="general" label="general"/>
        
      </item>
    
      <item>
        <title>Integrating JavaScript and C# with Script#</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/integrating_javascript_and_c_w.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/integrating_javascript_and_c_w.html</guid>
        <pubDate>Tue, 23 Aug 2011 23:09:48 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Have you ever had an enum in your server code that you wanted to access in client side code?  Or wanted the safety of compile time errors when there are discrepancies between your server-side and client-side code?  Or had a C# Data Transfer Object (DTO) that you wanted to enable Intellisense for in JavaScript?  I hadn't found a good solution either ... until now.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Compiling C# to What!?&lt;/b&gt;&lt;/p&gt;

&lt;div style=&quot;float:right; overflow: auto; margin-left:10px;&quot;&gt;
&lt;script type='text/javascript'&gt; 
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2011/08/integrating-javascript-and-c-with.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt; 
&lt;/div&gt;

&lt;p&gt;Compiling C# code into JavaScript may seem foreign, but &lt;a href=&quot; http://projects.nikhilk.net/ScriptSharp &quot;&gt;Script#&lt;/a&gt; is a mature technology that is absolutely worth a look.  Our team has been using it very happily for about three months.  We've found a number of benefits  including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistently working Intellisense&lt;/li&gt;
&lt;li&gt;Better encapsulation&lt;/li&gt;
&lt;li&gt;Simpler Object Orientation&lt;/li&gt;
&lt;li&gt;Easier deployment (Script# compiles multiple files to a single, optionally minified file)&lt;/li&gt;
&lt;li&gt;Safer refactoring&lt;/li&gt;
&lt;li&gt;Simpler unit testing&lt;/li&gt;
&lt;li&gt;Type safety; and&lt;/li&gt;
&lt;li&gt;Design time syntax checking (no more mistyping a variable and accidentally declaring it to the global scope)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scott Hanselman covered most of these topics in last month's Hanselminutes episode: &lt;a href=&quot; http://www.hanselminutes.com/default.aspx?showID=296&quot;&gt;Script# Compiles to JavaScript&lt;/a&gt;.  If you have a spare car ride I definitely recommend the listen.  But what wasn't covered were some additional benefits provided by an off the beaten path approach to this great technology.  The main benefit is tighter server side C# to client side JavaScript integration.  A secondary benefit is less of a dependency on Script#.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;To the Command Line&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Typically to get going with Script# you: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install the Script# Visual Studio plug-in&lt;/li&gt;
&lt;li&gt;File -&gt; New project&lt;/li&gt;
&lt;li&gt;Select &quot;Script Library&quot; and&lt;/li&gt;
&lt;li&gt;Compile to generate JavaScript&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Nice and easy.  The down side to this approach is you can't easily include files outside of your project.  Specifically, you can't include data transfer objects or enum's from your server side code.  Furthermore, all of your team members must install Script#.  If instead you compile with Script#'s &quot;ssc.exe&quot; command you obtain more control and get less dependency.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;How-To&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The how-to looks something like this:&lt;/p&gt;

&lt;ol&gt;

&lt;li&gt;&lt;a href=&quot;http://projects.nikhilk.net/ScriptSharp&quot;&gt;Download&lt;/a&gt; and install Script#&lt;/li&gt;
&lt;li&gt;Add a Class Library (not a Script# project)&lt;/li&gt;
&lt;li&gt;Project properties -&gt; Build -&gt; Advanced -&gt; &quot;Do not reference mscorlib&quot;&lt;br /&gt;
&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://4.bp.blogspot.com/-u7QvzHOOfxE/TlRhVwoGyII/AAAAAAAABu8/Vonkzc8nNLc/s1600/mscorlib.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 235px;&quot; src=&quot;http://4.bp.blogspot.com/-u7QvzHOOfxE/TlRhVwoGyII/AAAAAAAABu8/Vonkzc8nNLc/s400/mscorlib.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5644243259460339842&quot; /&gt;&lt;/a&gt;
&lt;/li&gt;

&lt;li&gt;Ideally move the Script# files (C:\Program Files (x86)\ScriptSharp) locally to the solution and check them into source control to a Libs or something similar&lt;/li&gt;

&lt;li&gt;Remove all references, but add: ScriptSharp.dll, ScriptSharp.Web.dll, Script.Jquery&lt;/li&gt;
&lt;li&gt;Edit your .csproj to manually reference Script#'s mscorlib (right click, Unload project, Edit MyProject.csproj)&lt;br /&gt;
    &lt;br /&gt;
    &lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;Reference&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt; &lt;/span&gt;
    &lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;color:red;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;Include&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA&quot;&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;mscorlib, Version=0.7.0.0, 
    Culture=neutral, PublicKeyToken=8fc0e3af5abcb6c4, processorArchitecture=MSIL&lt;/span&gt;&amp;quot;&lt;span 
        style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
    &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;SpecificVersion&lt;/span&gt;&lt;span 
        style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;True&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
        style=&quot;color:#A31515&quot;&gt;SpecificVersion&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
    &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;HintPath&lt;/span&gt;&lt;span 
        style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;..\Libs\ScriptSharp\v1.0\mscorlib.dll&lt;span 
        style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;HintPath&lt;/span&gt;&lt;span 
        style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Reference&lt;/span&gt;&lt;span style=&quot;color:
blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;

&lt;li&gt;Modify AssemblyInfo.cs and remove the following lines:&lt;br /&gt;
&lt;br /&gt;
[assembly: ComVisible(false)]&lt;br /&gt;
[assembly: Guid(&quot;b5e2449f-193c-46d1-9023-9143618d8491&quot;)]&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Modify AssemblyInfo.cs and add the following:&lt;br /&gt;
&lt;br /&gt;
[assembly: ScriptAssembly(&quot;ScriptSharpDemoAssembly&quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;

&lt;li&gt;Ensure it compiles in Visual Studio&lt;/li&gt;
&lt;li&gt;Create a batch script or PowerShell script that compiles using ssc.exe like this:&lt;br /&gt;
&lt;br /&gt;
..\Libs\ScriptSharp\v1.0\ssc.exe ^&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/debug ^&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/out:MyScriptSharp.js ^&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/ref:&quot;..\Libs\ScriptSharp\v1.0\Framework\mscorlib.dll&quot; ^&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.\Properties\AssemblyInfo.cs ^&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.\Class1.cs&lt;br /&gt;
&lt;br /&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notice the last two lines in the script are a list of the files that you want to include.  The point of this exercise is that you can now include files outside of your main Script# project in that list.&lt;/p&gt;
&lt;p&gt;Now for completeness if you put a simple static method in Class1.cs, something like this:&lt;/p&gt;
    &lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA&quot;&gt; MyScriptSharp&lt;br /&gt;
        {&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;
        &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Class1&lt;br /&gt;
        &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;
        &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        HelloWorld()&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
        return&lt;/span&gt; &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Hello World!&amp;quot;&lt;/span&gt;;&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
        }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Then run the batch file you should get something like this:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt;Type.registerNamespace(&lt;span style=&quot;color:maroon&quot;&gt;&amp;#39;MyScriptSharp&amp;#39;&lt;/span&gt;);&lt;br /&gt;
    &lt;br /&gt;
    &lt;span style=&quot;color:darkgreen&quot;&gt;
    ////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // MyScriptSharp.Class1&lt;br /&gt;
    &lt;br /&gt;
    &lt;/span&gt;MyScriptSharp.Class1 = &lt;span style=&quot;color:blue&quot;&gt;function&lt;/span&gt; 
    MyScriptSharp_Class1() {&lt;br /&gt;
    }&lt;br /&gt;
    MyScriptSharp.Class1.helloWorld = &lt;span style=&quot;color:blue&quot;&gt;function&lt;/span&gt; 
    MyScriptSharp_Class1$helloWorld() {&lt;br /&gt;
    &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;
    &lt;span style=&quot;color:maroon&quot;&gt;&amp;#39;Hello World!&amp;#39;&lt;/span&gt;;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    MyScriptSharp.Class1.registerClass(&lt;span style=&quot;color:maroon&quot;&gt;&amp;#39;MyScriptSharp.Class1&amp;#39;&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Obviously you could get these results faster with approach #1.  But now you have a lot more control.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The main downside to this approach is maintaining the batch file is a bit of a hassle.  But the upsides are that you can include any file from your server-side C# code.  And any changes in that server-side code are automatically reflected in your JavaScript.  And any breaking changes in your server-side code generate compile time errors in your client side code.  And furthermore none of your team members need to install Script#.  For our team it's an easy tradeoff.  What about for yours?  Please share your thoughts in the comments or on &lt;a href=&quot;http://twitter.com/#!/lprichar&quot;&gt;twitter&lt;/a&gt;.&lt;/p&gt;
 
</description>
        
          <category term=".net" label=".net"/>
        
          <category term="javascript" label="javascript"/>
        
      </item>
    
      <item>
        <title>Advanced Burn Up Charts</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/advanced_burn_up_charts.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/advanced_burn_up_charts.html</guid>
        <pubDate>Mon, 11 Apr 2011 08:52:53 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;If you've read my previous posts on the subject you know that I love agile &lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/forget_burndown_use_burnup_charts.html&quot;&gt;burn up charts&lt;/a&gt; for managing SCRUM style projects, particularly compared to burn down charts.&lt;/p&gt;
&lt;div style='float:right; margin-left:10px;'&gt; 
&lt;script type='text/javascript'&gt; 
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2011/04/advanced-burn-down-charts.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt; 
&lt;/div&gt; 
&lt;blockquote&gt;
The problem is that burndown charts lack two essential pieces of information. First, how much work was actually accomplished during a given iteration (as opposed to how much work remains to be completed) and second how much total work the project contains (or if you prefer how much scope has increased each iteration). &lt;/blockquote&gt;
&lt;p&gt;What you might not know is how flexible they can be.  In particular the example I gave last time has a problem.  Can you spot it?&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/SQExi1j16lI/AAAAAAAABlM/pqg4SgFBkIs/s1600-h/Burnup.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 273px;&quot; src=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/SQExi1j16lI/AAAAAAAABlM/pqg4SgFBkIs/s400/Burnup.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5260540314308176466&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The problem is that the scope increase of 20 points in iteration six might very well have had zero impact on the actual deployment date.  Those points might have all been low priority tasks that the team will work on after they deploy the initial 100 points.  Wouldn't it be nice if the burn up chart could convey priority information as well?&lt;/p&gt;
&lt;p&gt;So that's exactly what I did on my current project last week, and it appeared to be a big hit.  And with the addition of some Excel trend lines the chart was able to convey a lot of insight into the project:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://1.bp.blogspot.com/-nqHRslSmh3I/TaL1f1sZ2CI/AAAAAAAABt4/Z5i4iyXrFh8/s1600/Burnup1.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 173px;&quot; src=&quot;http://1.bp.blogspot.com/-nqHRslSmh3I/TaL1f1sZ2CI/AAAAAAAABt4/Z5i4iyXrFh8/s400/Burnup1.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5594303614485649442&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Obviously all that data is made up, but the chart still tells an interesting story:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The customer hasn't been adding high priority tasks, perhaps because there is a hard deadline approaching&lt;/li&gt;
&lt;li&gt;Because of the customer's restraint in adding high priority tasks the team can be fairly confident that they will finish all the high priority tasks by Iteration 3&lt;/li&gt;
&lt;li&gt;While the customer hasn't added high priority tasks they have still been able to be agile by adding normal and low priority tasks&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What's really wonderful about this way of reporting is that it gives the customer the flexibility to add scope to future iterations while maintaining near term deadlines.  In short it supports what agile is supposed to be about.&lt;/p&gt;
&lt;p&gt;But why stop there?  Depending on the story you need to tell or the scenario you need to evaluate perhaps you could incorporate team member contributions.  For example:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/-J0lMgjTfmFw/TaL1fwd7rqI/AAAAAAAABuA/p1QyRmW5Byk/s1600/Burnup2.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 162px;&quot; src=&quot;http://3.bp.blogspot.com/-J0lMgjTfmFw/TaL1fwd7rqI/AAAAAAAABuA/p1QyRmW5Byk/s400/Burnup2.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5594303613082775202&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In this example we can try to show what might happen if we remove a particular team member or if we'd never had a particular team member.  What's unique about this way or reporting is that it's incorporating the backlog's increasing trend into account.  While it's possible that the backlog may increase or decrease at a different rate with a different team makeup, it's a better scenario than ignoring the rate of increase of the backlog all together.&lt;/p&gt;
&lt;p&gt;Perhaps we could incorporate other information.  Maybe bug vs. feature information.  Or planned vs. actual (e.g. task slippage) information.  It seems like there is a lot of potential.  Any other ideas out there?  Feel free to post in the comments or via &lt;a href=&quot;http://www.twitter.com/lprichar&quot;&gt;twitter&lt;/a&gt;.  If there's enough interest I'd be happy to post another screencast similar to the last one I did on &lt;a href=&quot; http://www.nearinfinity.com/blogs/lee_richardson/video_how_to_create_burndown_c.html&quot;&gt;how to produce burn up and burn down with SharePoint and Excel&lt;/a&gt; except this time with trends and priorities.&lt;/p&gt;
&lt;p&gt;So overall while these charts may be a little more complicated than a traditional burn down chart they would make an excellent talking point during a PowerPoint presentation, or as part of your iteration close out.  And with a little training I bet just about any customer would learn to love the insight they provide.&lt;/p&gt; 
</description>
        
          <category term="agile" label="agile"/>
        
          <category term="development" label="development"/>
        
      </item>
    
      <item>
        <title>Death to the DAO and How to Test LINQ</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/death_to_the_dao_and_how_to_te.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/death_to_the_dao_and_how_to_te.html</guid>
        <pubDate>Thu, 22 Jul 2010 22:42:43 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Occasionally I hear complaints that LINQ is hard to unit test.  These complaints aren't about LINQ to objects, mind you, they're specific to the complexities of the flavors of LINQ that turn C# code into something else like SQL or CAML using &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/expression-trees-why-linq-to-sql-is.html&quot;&gt;expression trees&lt;/a&gt;.  The most common technologies are LINQ to SQL, the Entity Framework, or in my case at the moment LINQ to SharePoint.  In this post I'm going to propose a technique that makes testing LINQ not just easy, but downright elegant - assuming you're ok with extension methods - lots of extension methods.  And assuming you're ready to kill your Data Access Objects (DAO) tier.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2010/07/death-to-dao-and-how-to-test-linq.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;


&lt;p&gt;&lt;b&gt;The Unit Testing Problem&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Any architecture needs a place to put code that finds entities.  For instance FindBySocialSecurityNumber().  In a traditional architecture we might put a method like this is in a DAO layer.  If so our method will look something like this:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt; &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt; EmployeesDao&lt;/span&gt; {&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt; FindBySSN(&lt;span   style=&quot;color:#2B91AF&quot;&gt;Context&lt;/span&gt; ctx, &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;  ssn) {&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;  ctx.Employees.SingleOrDefault(e =&amp;gt; e.Ssn == ssn);&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;So how would we go about unit testing this?&lt;/p&gt;&lt;p&gt;One fairly typical solution would be to use an in-memory database.  That approach works if our data store is a database, but it certainly doesn't work if the data store is something less traditional like SharePoint.  But even if our store is a database, we'll still have the hassle of setting up the in-memory database.&lt;/p&gt;&lt;p&gt;Another solution might be to use a mock Context that returns an IQueryable&lt;Employee&gt;.  But wouldn't it be wonderful if we could avoid mocking all together?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Killing the DAO&lt;/b&gt;&lt;/p&gt;&lt;p&gt;The first question is why we even have a DAO tier to begin with.  The original idea was that we wanted a place to put code specific to a particular data store.  In other words we wanted to isolate the code that will need to be changed should the data store switch from SQL Server to Oracle.  But isn't that exactly what LINQ does?  I'd be pretty surprised if there wasn't a decent LINQ provider for just about any data store at this point that required more than minimal code changes.  So why not embrace LINQ and reconsider alternatives to a DAO tier?&lt;/p&gt;&lt;p&gt;One alternative that I've been using for over a month now is to switch to extension methods.  To give credit where it's due the idea originated with a conversation with fellow &lt;a href=&quot;http://www.nearinfinity.com&quot;&gt;Near Infinity&lt;/a&gt; employee &lt;a href=&quot;http://www.nearinfinity.com/blogs/joe_ferner/&quot;&gt;Joe Ferner&lt;/a&gt;.  And I'm sure the idea isn't particularly original (please post in the comments if you know others that use this approach).&lt;/p&gt;&lt;p&gt;Using this technique our code changes from something like this:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:R-SA&quot;&gt; employeeDao = &lt;span style=&quot;color:blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;EmployeesDao&lt;/span&gt;(); &lt;span style=&quot;color:green&quot;&gt;//  or use IOC of course&lt;br /&gt; &lt;/span&gt;employeeDao.FindBySSN(ctx, &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;111-11-1111&amp;quot;&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;To something like this:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;ctx.Employees.FindBySSN(&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;111-11-1111&amp;quot;&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Among other things I find this far more aesthetically pleasing because each of the three elements to the statement represent a subsequent filtering of data.  It's a more functional way of looking at things.&lt;/p&gt;&lt;p&gt;We could implement this off of the Employees property of the context if we have control over that (which I don't with spmetal). But if we implement this as an extension method like this:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt; &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;EmployeeExtensions&lt;/span&gt; {&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;  FindBySSN(&lt;span style=&quot;color:blue&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt; IQueryable&lt;/span&gt;&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;&amp;gt; employees, &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; ssn) {&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;  employees.SingleOrDefault(e =&amp;gt; e.Ssn == ssn);&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;We now have something that's considerable easier to unit test.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Testing It&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Once we've refactored our function as an extension method that filters down the corpus of entities, we can test the code using in-memory objects with a call to .AsQueryable().  For instance:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:R-SA&quot;&gt; &lt;span style=&quot;color:blue&quot;&gt;void&lt;/span&gt;  FindBySSN_OneSsnExists_EmployeeReturned() {&lt;br /&gt; &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt;  employees = &lt;span style=&quot;color:blue&quot;&gt;new&lt;/span&gt; [] { &lt;span style=&quot;color:blue&quot;&gt; new&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt; { Ssn = &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;111-11-1111&amp;quot;&lt;/span&gt; } };&lt;br /&gt; &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt;  actual = employees.AsQueryable().FindBySSN(&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;111-11-1111&amp;quot;&lt;/span&gt;);&lt;br /&gt; &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Assert&lt;/span&gt;.IsNotNull(actual); &lt;br /&gt; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Notice we didn't have to mock anything.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Testability, but at What Cost?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;This technique works great for the example above, but how does it scale to harder problems and what other downsides are there?&lt;/p&gt;&lt;p&gt;As far as scalability I've found this technique works great for every scenario I've run across in the month I've been doing it.  It works for joins, aggregations, and even for inserts, update, and deletes.&lt;/p&gt;&lt;p&gt;As far as downsides the astute reader may be wondering about mockability.  For instance what if we want to mock the call to FindBySSN and give it the exact Employee that will be returned.  This scenario is admittedly harder.  But what I've found is that far more often than not I don't really need to mock the types of things that used to live in the DAO tier.  Instead I just mock the Employee object off of context to return in-memory objects and make my tests slightly larger in scope.  Most of the time I find the larger scope increases the usefulness of the test.  In the occasional case where I do really want to mock the &quot;DAO&quot; tier I use a technique described in &lt;a href=&quot; http://www.clariusconsulting.net/blogs/kzu/archive/2009/02/19/Makingextensionmethodsamenabletomocking.aspx&quot;&gt;this post&lt;/a&gt; by Daniel Cazzulino.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Obviously there is more to this architecture, for instance how do you handle insert and update operations?  The short answer is it's easy, but I'll save that topic for a future post.  For now why not give this approach a try?  You weren't really happy with that useless old DAO tier anyway, were you?  I say we eradicate it and never look back.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>ASP.AJAX 4 Templates Part 4 - jQuery, and Manual JSON Object Manipulation</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/aspajax_4_templates_part_4_-_j.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/aspajax_4_templates_part_4_-_j.html</guid>
        <pubDate>Sat, 10 Apr 2010 14:03:06 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;This is part 4 of a multi-part series exploring building client side AJAX applications with ASP.Net AJAX 4 Templating and the WCF Data Services (aka ADO.Net Data Services, aka oData, aka Astoria) in SharePoint 2010.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2010/04/aspajax-4-templates-part-4-jquery-and.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications.html&quot;&gt;Part 1 - Exploring WCF Data Services in SharePoint 2010&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html&quot;&gt;Part 2 - Creating a read-only page with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html&quot;&gt;Part 3 - Writing data back to SharePoint with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/aspajax_4_templates_part_4_-_j.html&quot;&gt;Part 4 - jQuery and Manual JSON Object Manipulation&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;In the previous posts in this series I've shown how you can access SharePoint data using WCF Data Services, how you can display that data using ASP.Net AJAX 4.0 Templates, and how you can write data back to SharePoint.&lt;/p&gt;

&lt;p&gt;In this post I'll take writing data back to SharePoint a step further by showing how you can modify non-visible fields by modifying JSON objects directly.  More specifically I'll enable dragging user story index cards on a virtual bulletin board using a jQuery plugin, save the X and Y coordinates back to JSON objects, and then save the updated records back to SharePoint. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Cards on a Corkboard&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The first thing I'll do is style the cards and display them with absolute position.  While I'm at it I'll also reference the &lt;a href=&quot; http://jqueryui.com/demos/droppable/ &quot;&gt;draggable&lt;/a&gt; jQuery UI plugin.  If you're following along at home just built a custom .js download from the jQuery UI site, drop it in your layouts directory and add a reference.  So my PageHead content control now looks like this:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:9.5pt;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:maroon&quot;&gt;content&lt;/span&gt;&lt;span    style=&quot;font-size:9.5pt;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas&quot;&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PageHead&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;contentplaceholderid&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderAdditionalPageHead&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjax.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span    style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxDataContext.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span    style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxTemplates.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span    style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxAdoNet.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span    style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../jquery-ui-1.8.custom/js/jquery-1.4.2.min.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span    style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../jquery-ui-1.8.custom/js/jquery-ui-1.8.custom.min.js&amp;quot;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span    style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;style&lt;/span&gt;  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;.sys-template&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;{&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;display&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;none&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  }&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:maroon&quot;&gt;.userstorycard&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;{&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;border&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;1px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;solid&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;#777777&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;200px&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;position&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;  absolute&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;cursor&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;move&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  }&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:maroon&quot;&gt;.carddescription&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;{&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;font-size&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;13px&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;background-image&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;  url(&amp;#39;card_bg.jpg&amp;#39;)&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;padding&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;5px&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;5px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;5px&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  }&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:maroon&quot;&gt;.cardtitle&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;{&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;font-size&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;15px&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;font-weight&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;bold&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;padding&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;border-bottom&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;  1px&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;solid&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;red&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;  White&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;padding&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;5px&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;0px&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;5px&lt;/span&gt;;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  }&lt;br style=&quot;mso-special-character:line-break&quot; /&gt;  &lt;![if !supportLineBreakNewLine]&gt;  &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;  &lt;![endif]&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt; &lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;/span&gt;

&lt;p&gt;The next thing to do is add X and Y fields to the user story list in SharePoint.  And finally display the cards with absolute positioning:&lt;/p&gt;

&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;span style=&quot;color:#A31515&quot;&gt;xmlns&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;sys&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;javascript:Sys&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;background&amp;quot;&amp;gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span     style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;userStories&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;sys-template&amp;quot;&amp;gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span     style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;userStoryCard&amp;quot;&lt;/span&gt;   &lt;br /&gt;   &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b     style=&quot;mso-bidi-font-weight:normal&quot;&gt;&lt;span style=&quot;color:#A31515&quot;&gt;sys&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;style&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;quot;&amp;gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;   &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;userStoryTitle&amp;quot;&amp;gt;&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span     style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;=&amp;quot;userStoryBody&amp;quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt;&lt;span     style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span     style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span     style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span     style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;   &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Notice the sys:style attribute.  The sys: part is the namespace you need to add for attributes when using templating that I mentioned in &lt;a href=&quot; http://rapidapplicationdevelopment.blogspot.com/2010/03/client-side-ajax-applications-in_3617.html&quot;&gt;part three&lt;/a&gt;.  Also notice the JavaScript string concatenation inside the binding.  You can put in any JavaScript in there that you like.  So now if you manually set X and Y values in SharePoint for a card the card shows in the right place.  But we're still missing the ability to drag cards.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Making Cards Draggable with jQuery&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In order to enable dragging support you're supposed to call the draggable() function on the DOM elements you want to make draggable.  Simple right?  You just call $(&quot;.userstorycard&quot;).draggable() which should find every element with a class of userstorycard and call draggable() on it.&lt;/p&gt;

&lt;p&gt;But if you do this onLoad() then ASP.Net AJAX Templating engine hasn't had a chance to render the new DOM elements yet.  Fortunately the DataView has the JavaScript equivalent of an OnRendered event that you can tie into:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt; onLoad() {&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dataContext = $create(&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Sys.Data.AdoNetDataContext,  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ serviceUri:  &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;/demoprep/_vti_bin/ListData.svc&amp;quot;&lt;/span&gt; }&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;br /&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dataView = $create(&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Sys.UI.DataView,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;autoFetch:  &lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dataProvider: dataContext,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;fetchOperation:  &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;UserStories&amp;quot;&lt;/span&gt;,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;fetchParameters: { $top: 20 }&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;},&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;rendered: onRendered&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;},&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$get(&lt;span style=&quot;color:maroon&quot;&gt;&amp;#39;userStories&amp;#39;&lt;/span&gt;)&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;span style=&quot;color:blue&quot;&gt;function&lt;/span&gt; onRendered() {&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:darkgreen&quot;&gt;// from   http://jqueryui.com/demos/draggable/&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$(&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;.userstorycard&amp;quot;&lt;/span&gt;).draggable();&lt;br /&gt;  }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;And that's it for enabling dragging.  Pretty simple.  The result looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_gez10dNhuPk/S8C5Crk0xAI/AAAAAAAABss/y3vsN5TbKQA/s1600/part4-1-screenshot.jpg&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 334px;&quot; src=&quot;http://1.bp.blogspot.com/_gez10dNhuPk/S8C5Crk0xAI/AAAAAAAABss/y3vsN5TbKQA/s400/part4-1-screenshot.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5458566204081095682&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, well you can't see the dragging support, but it's there, trust me.  And it's pretty cool except for one thing.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Saving Non-Visible Properties&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The problem is that every time you refresh the page the nice layout you've done disappears and everything goes back to being stacked one on top of the other in the upper left.  My first thought was to create input type=hidden form elements on the page.  This approach causes a lot more plumbing code than is necessary.  The better way is that you can access the underlying in-memory JSON objects.  Step one is to register an &quot;event&quot; for when the user stops dragging a card.&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt; onRendered() {&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:darkgreen&quot;&gt;// from   http://jqueryui.com/demos/draggable/&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$(&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;.userstorycard&amp;quot;&lt;/span&gt;).draggable({&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;stop: onDragStop&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;});&lt;br /&gt;  }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Once you wire that up the onDragStop() function is where all the interesting stuff happens:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Consolas;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt; onDragStop(event, ui) {&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt;   userStoryCard = ui.helper[0];&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt;   selectedUserStoryJsonObject =  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;dataView.findContext(userStoryCard).dataItem;&lt;br /&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt;   newX = ui.position.left;&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt;   newY = ui.position.top;&lt;br /&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  Sys.Observer.setValue(selectedUserStoryJsonObject, &lt;span style=&quot;color:maroon&quot;&gt;  &amp;quot;X&amp;quot;&lt;/span&gt;, newX);&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  Sys.Observer.setValue(selectedUserStoryJsonObject, &lt;span style=&quot;color:maroon&quot;&gt;  &amp;quot;Y&amp;quot;&lt;/span&gt;, newY);&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dataContext.saveChanges();&lt;br /&gt;  }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The first line gets the DOM element that just the user just completed dragging.  The second line retrieves the in memory JSON object represented by that DOM element.  The next couple of lines get the X and Y that the user story card was dragged to relative to their parent DOM element.  And then something odd happens.&lt;/p&gt;

&lt;p&gt;Sys.Observer.setValue looks so complicated.  Why couldn't we just call selectedUserStoryJsonObject.X = newX?&lt;/p&gt;

&lt;p&gt;Well, if we'd done that the DataView wouldn't know about the change we just made.  If we then tried to call dataContext.saveChanges() nothing would get sent back to the server.  &lt;a href=&quot; http://msdn.microsoft.com/en-us/library/dd393596%28VS.100%29.aspx&quot;&gt;Sys.Observer.setValue&lt;/a&gt; notifies any interested parties, in this case the DataView, that a value has been changed.  And this enables the functionality we saw in &lt;a href=&quot;&quot;&gt;part two&lt;/a&gt; where the DataView only sends the relevant records back to SharePoint instead of the entire set of JSON objects.&lt;/p&gt;

&lt;p&gt;And so, with this code in place, we can now move user story cards around on the page and when we refresh the page or come back days later our layout has persisted back into SharePoint.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In this post you've seen how to directly modify the in-memory JSON objects and send them back to SharePoint.  Our application is finally getting interesting and I find it quite remarkable how little code it's taken.  In the next post I'll show how to do master-detail scenario's for editing user story cards.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Client Side AJAX Applications in SharePoint 2010 - Part 3</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html</guid>
        <pubDate>Sun, 21 Mar 2010 22:17:25 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description> &lt;p&gt;Note: This is one of a multi-part series exploring building client side AJAX applications with ASP.Net AJAX 4 Templating and the WCF Data Services (aka ADO.Net Data Services, aka oData, aka Astoria) in SharePoint 2010.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2010/03/client-side-ajax-applications-in_3617.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications.html&quot;&gt;Part 1 - Exploring WCF Data Services in SharePoint 2010&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html&quot;&gt;Part 2 - Creating a read-only page with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html&quot;&gt;Part 3 - Writing data back to SharePoint with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/aspajax_4_templates_part_4_-_j.html&quot;&gt;Part 4 - jQuery and Manual JSON Object Manipulation&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;In the previous two posts in this series I've shown how you can access SharePoint data using WCF Data Services and consume that data using ASP.Net AJAX 4 templates.  In this post I'll update the previous example in order to show how to write data back to SharePoint.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Templates and Linking&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Before we go into writing data back let's modify our example to link each item back to the SharePoint DispForm.aspx page.  A naïve approach would look like this:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;userStoriesList&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;sys-template&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;../../Lists/User%20Stories/DispForm.aspx?ID=&amp;#123;&amp;#123; ID &amp;#125;&amp;#125;&amp;quot;&amp;gt;&lt;/span&gt;&amp;#123;&amp;#123; Title &amp;#125;&amp;#125;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;a&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;It turns out this approach doesn't work because the DataView won't look for the data binding syntax inside of attributes.  The next approach that might make sense would now be to set href to a data binding syntax and inside there do some string concatenation like so:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
line-height:115%;font-family:Consolas;mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;color:maroon;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;&amp;#123;&amp;#123; &amp;#39;../../Lists/User%20Stories/DispForm.aspx?ID=&amp;#39; + ID 
  &amp;#125;&amp;#125;&amp;quot;&amp;gt;&lt;/span&gt;&amp;#123;&amp;#123; Title &amp;#125;&amp;#125;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;It turns out this doesn't work either, but for a different reason.  Apparently the DataView can't natively convert some HTML attributes like href and src for reasons &lt;a href=&quot; http://weblogs.asp.net/bleroy/archive/2008/07/30/using-client-templates-part-1.aspx&quot;&gt;Bertrand La Roy&lt;/a&gt; describes.  The solution is to prefix the attribute with the ASP.Net AJAX system namespace.  Typically you would define the system namespace on the HTML body element.  But with SharePoint you don't have access to this element.  Fortunately you can declare this namespace on any element so the following code works:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:red&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;javascript:Sys&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;userStoriesList&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;sys-template&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;sys&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;&amp;#123;&amp;#123; &amp;#39;../../Lists/User%20Stories/DispForm.aspx?ID=&amp;#39; + ID 
  &amp;#125;&amp;#125;&amp;quot;&amp;gt;&lt;/span&gt;&amp;#123;&amp;#123; Title &amp;#125;&amp;#125;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Great.  Let's move on to updating data.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Live Binding Syntax&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The &amp;#123;&amp;#123; &amp;#125;&amp;#125; template syntax we've seen so far is what's known as one time binding.  When you use this syntax the expression is evaluated only once when the template is rendered.  What we want is one way live binding and/or two way live binding.&lt;/p&gt;

&lt;p&gt;In order to understand the live bindings you need to understand that behind the scenes the DataView keeps an in memory copy of all of the JSON objects it downloads.  It's possible for the data in these objects to change.  And that's where one way live bindings come in.  When you use the syntax { binding [FieldName] }, the DataView will automatically update the binding when the underlying JSON object changes.&lt;/p&gt;

&lt;p&gt;Two way live binding happens automatically when you use the one way live binding syntax on HTML INPUT elements.  For these scenarios the DataView automatically updates the in memory JSON objects.  Then the DataView updates any one way live binding's.&lt;/p&gt;

&lt;p&gt;So let's throw two DataViews onto the page, one with one way live bound hyperlinks, one with two way bound HTML INPUT textbox elements and see what happens:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
 function&lt;/span&gt; pageInit() {&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt; 
 dataContext = $create(Sys.Data.AdoNetDataContext, { serviceUri:
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;/demoprep/_vti_bin/ListData.svc&amp;quot;&lt;/span&gt; });&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$create(Sys.UI.DataView,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;autoFetch:
 &lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;dataProvider: 
 dataContext,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;fetchOperation:
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;UserStories&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;fetchParameters: { 
 $top: 20 }&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;},&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;$get(&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;userStoriesList&amp;quot;&lt;/span&gt;)&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;);&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$create(Sys.UI.DataView,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;autoFetch:
 &lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;dataProvider: 
 dataContext,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;fetchOperation:
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;UserStories&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;fetchParameters: { 
 $top: 20 }&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;},&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;$get(&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;userStoriesTable&amp;quot;&lt;/span&gt;)&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;);&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Sys.Application.add_init(pageInit);&lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;div&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:red&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;javascript:Sys&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;userStoriesList&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;sys-template&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;sys&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;&amp;#123;&amp;#123; &amp;#39;../../Lists/User%20Stories/DispForm.aspx?ID=&amp;#39; + ID 
  &amp;#125;&amp;#125;&amp;quot;&amp;gt;&lt;/span&gt;{ binding Title }&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;thead&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Title&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;td&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;thead&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;tbody&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;userStoriesTable&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:
red&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;sys-template&amp;quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;text&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;sys&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;value&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;{binding Title}&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;tbody&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;div&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Notice the input element with the sys:value bound to title and the new binding syntax in the text of the a href.  The result looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6bMoFgda1I/AAAAAAAABsk/LwN6UrGi--g/s1600-h/part3-1-endresult.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 269px; height: 400px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6bMoFgda1I/AAAAAAAABsk/LwN6UrGi--g/s400/part3-1-endresult.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5451269388023720786&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It may not be all that pretty yet, but if you change the text in any of the text boxes the result is immediately updated in the hyperlinks on mouse out.  But if you hop back to SharePoint or refresh the page you'll see that our data hasn't been updated.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Updating SharePoint, For Real This Time&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Just because the DataView updated the in memory JSON objects it's bound to doesn't mean it sent a POST request back to ListData.svc.  To accomplish that we need to call dataContext.saveChanges().  If you toss in a button below the table like this:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;button&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;dataContext.saveChanges()&amp;quot;&amp;gt;&lt;/span&gt;Save 
 Changes&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;button&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;And move the dataContext variable to a higher scope like this:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt; dataContext;&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;function&lt;/span&gt; onLoad() {&lt;br /&gt;
 &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dataContext = 
 $create(Sys.Data.AdoNetDataContext, { serviceUri: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;/demoprep/_vti_bin/ListData.svc&amp;quot;&lt;/span&gt; });&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Then when you click the button the AdoNetDataContext figures out which JSON objects changed and sends just those objects back to ListData.svc.  How do you know it only sends the rows that changed?  If you look at Fiddler there will be a POST to ListData.svc/$batch with something like the following:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;style1&quot; 
  style=&quot;font-size: 11.0pt; line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-themecolor: background1; mso-style-textfill-fill-color: white; mso-style-textfill-fill-themecolor: background1; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-colortransforms: lumm=50000; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;
 --batch_d425-6668-6b05&lt;br /&gt;
 Content-Type: multipart/mixed;boundary=changeset_8a05-bdcd-0b3e&lt;br /&gt;
 --changeset_8a05-bdcd-0b3e&lt;br /&gt;
 Content-Type: application/http&lt;br /&gt;
 Content-Transfer-Encoding: binary&lt;br /&gt;
 MERGE http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3) HTTP/1.1&lt;br /&gt;
 If-Match: W/&amp;quot;3&amp;quot;&lt;br /&gt;
 Host: localhost&lt;br /&gt;
 Accept: application/json&lt;br /&gt;
 Accept-Charset: utf-8&lt;br /&gt;
 Content-Type: application/json;charset=utf-8&lt;/span&gt;&lt;span style=&quot;font-size:11.0pt;line-height:115%;
font-family:&amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-theme-font:minor-bidi;
color:white;mso-themecolor:background1;mso-style-textfill-fill-color:white;
mso-style-textfill-fill-themecolor:background1;mso-style-textfill-fill-alpha:
100.0%;mso-style-textfill-fill-colortransforms:lumm=50000;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;&lt;br /&gt;
 &lt;/span&gt;
 &lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;{&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__metadata&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;:&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3)&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;etag&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;W/\&amp;quot;3\&amp;quot;&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;type&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Microsoft.SharePoint.DataService.UserStoriesItem&amp;quot;&lt;/span&gt;},&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ContentTypeID&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;0x01080070E2807D369BD94FBD6C057D3110E6D3&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Renamed 
 Task&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Predecessors&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;:{&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3)/Predecessors&amp;quot;&lt;/span&gt;}},&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Priority&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:
maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;:&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3)/Priority&amp;quot;&lt;/span&gt;}},&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;PriorityValue&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;(2) 
 Normal&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Status&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;:{&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3)/Status&amp;quot;&lt;/span&gt;}},&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;StatusValue&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Not 
 Started&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Complete&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;AssignedToID&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;TaskGroupID&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Description&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;StartDate&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:
maroon&quot;&gt;&amp;quot;\/Date(1266624000000)\/&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;DueDate&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Points&amp;quot;&lt;/span&gt;:8,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Iteration&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;:{&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3)/Iteration&amp;quot;&lt;/span&gt;}},&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;IterationID&amp;quot;&lt;/span&gt;:1,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;:3,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ContentType&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Task&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Modified&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;\/Date(1269128451000)\/&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Created&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;\/Date(1266679964000)\/&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;CreatedByID&amp;quot;&lt;/span&gt;:1,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ModifiedByID&amp;quot;&lt;/span&gt;:1,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Owshiddenversion&amp;quot;&lt;/span&gt;:3,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Version&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;3.0&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Attachments&amp;quot;&lt;/span&gt;:{&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;:{&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(3)/Attachments&amp;quot;&lt;/span&gt;}},&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Path&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;/demoprep/Lists/User 
 Stories&amp;quot;&lt;/span&gt;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;/span&gt;&lt;span class=&quot;style1&quot; 
  style=&quot;font-size: 11.0pt; line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-style-textfill-fill-color: #000000; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-colortransforms: &amp;quot;lumm=60000 lumo=40000&amp;quot;; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;
 --changeset_8a05-bdcd-0b3e--&lt;br /&gt;
 --batch_d425-6668-6b05--&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;And that, as you may have noticed, is the JSON for just a single of the rows that we were displaying.&lt;/p&gt;
&lt;p&gt;But how did the AdoNetDataContext know which objects were changed?  &lt;a href=&quot; http://lostintangent.com/2009/06/ &quot;&gt;Jonathan Carter&lt;/a&gt; explains this better than I could but basically when the data context downloads JSON objects it injects them with the ability to notify itself when they change.  As Jonathan points out it's a neat trick that would not be possible in a statically typed language.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;We've finally gotten to some of the core benefits of using ASP.Net AJAX 4 Templating.  With very little JavaScript we were able to cleanly separate our UI from our data access code and write data back to the server.  And the amount of HTTP traffic and server operations was kept to a bare minimum, keeping things as fast and responsive as possible.  So all we're missing at this point is how to use it to make something real out of these technologies.  And that will be the topic for the &lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/aspajax_4_templates_part_4_-_j.html&quot;&gt;next post&lt;/a&gt;.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Client Side AJAX Applications in SharePoint 2010 - Part 2</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html</guid>
        <pubDate>Sun, 21 Mar 2010 20:36:54 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Note: This is one of a multi-part series exploring building client side AJAX applications with ASP.Net AJAX 4 Templating and the WCF Data Services (aka ADO.Net Data Services, aka oData, aka Astoria) in SharePoint 2010.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2010/03/client-side-ajax-applications-in_21.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;


&lt;p&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications.html&quot;&gt;Part 1 - Exploring WCF Data Services in SharePoint 2010&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html&quot;&gt;Part 2 - Creating a read-only page with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html&quot;&gt;Part 3 - Writing data back to SharePoint with ASP.Net AJAX 4.0 Templates&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;In &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2010/03/client-side-ajax-applications-in.html&quot;&gt;Part 1&lt;/a&gt; I described how SharePoint 2010 exposes list data through ListData.svc and WCF Data Services.  So far this is interesting, but the next logical question is how would you actually build a Web 2.0 application with the data?  One answer is with a new technology called ASP.Net AJAX 4.0 Client Side Templating.  I'll give you some background and then provide a walkthrough of how to build a SharePoint application page that reads and writes data to SharePoint through ListData.svc.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;What is ASP.Net AJAX 4.0 Client Side Templating?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In Part 1 I talked about some of the problems with the two existing ways of writing Web 2.0 interfaces.  ASP.Net AJAX 4.0 Client Side Templating addresses most of these issues.  Specifically it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Minimizes plumbing code&lt;/li&gt;
&lt;li&gt;Cleanly separates presentation from data access code&lt;/li&gt;
&lt;li&gt;Simplifies saving data back to the server via Live Data Bindings&lt;/li&gt;
&lt;li&gt;Has no ViewState!&lt;/li&gt;
&lt;li&gt;Uses lightweight JSON rather than HTML&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sounds good?  Ready to see some code?&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Show Me The Code&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Note: This walkthrough assumes you haven't played with Visual Studio 2010 and SharePoint 2010, so please skip ahead to &quot;No Really, Show Me the AJAX Templating Code&quot; if you've already seen the sweet SharePoint and Visual Studio integration.&lt;/p&gt;
&lt;p&gt;To get started open Visual Studio 2010.  Select New Project and for the template navigate to SharePoint then 2010 select &quot;Empty SharePoint Project&quot; (p.s. see &lt;a href=&quot; http://httpcode.com/blogs/PermaLink,guid,357e4853-9a75-4962-ad68-1e07bcf40bb8.aspx&quot;&gt;Visual Web Part&lt;/a&gt; in the list?  Make sure you look that up if you haven't heard of it yet).&lt;/p&gt;


&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6akfBI5uSI/AAAAAAAABr8/XZ97uHe4fIY/s1600-h/part2-1-vstemplates.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 306px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6akfBI5uSI/AAAAAAAABr8/XZ97uHe4fIY/s400/part2-1-vstemplates.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;Img2&quot; /&gt;&lt;/a&gt;


&lt;p&gt;If you haven't been keeping up with what's new in SharePoint 2010 you should immediately notice that SharePoint integration is built into Visual Studio 2010 out of the box just based on the listed templates.  But just wait, it gets much better. &lt;/p&gt;

&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6akfS6krBI/AAAAAAAABsE/0hTDT72N8Gc/s1600-h/part2-2-specifysite.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 317px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6akfS6krBI/AAAAAAAABsE/0hTDT72N8Gc/s400/part2-2-specifysite.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;Img4&quot; /&gt;&lt;/a&gt;


&lt;p&gt;The next screen asks what site you want to use for debugging.  It's asking this because when you hit F5 (&quot;Start Debugging&quot;) Visual Studio 2010 packages up your wsp file, deployes it to the URL you enter here, attaches to the w3wp process, and opens a browser into SharePoint, and you're immediately in debug mode!  &lt;/p&gt;
&lt;p&gt;If you aren't deeply impressed then you haven't developed in WSS 3.0.  Now we aren't writing any server side code in this tutorial, but it's still extremely impressive how much work Microsoft has put into making SharePoint a first class citizen.&lt;/p&gt;
&lt;p&gt;Once you have your site select Project -&gt; Add New Item and select Application Page.&lt;/p&gt;


&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/S6akfkNRsFI/AAAAAAAABsM/5kPkOSkDPRM/s1600-h/part2-3-addnewitem.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 323px;&quot; src=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/S6akfkNRsFI/AAAAAAAABsM/5kPkOSkDPRM/s400/part2-3-addnewitem.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5451225261180825682&quot; /&gt;&lt;/a&gt;

&lt;p&gt;Visual Studio then plops out a page that's 100% ready to go including the correct Content controls for the SharePoint master page.&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size: 9.5pt; line-height: 115%; font-family: Consolas; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; background: yellow; mso-highlight: yellow; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;
 &amp;lt;%&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA&quot;&gt; &lt;span style=&quot;color:maroon&quot;&gt;Assembly&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;$SharePoint.Project.AssemblyFullName$&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Import&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Namespace&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.SharePoint.ApplicationPages&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Register&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Tagprefix&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;SharePoint&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Namespace&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.SharePoint.WebControls&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Assembly&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.SharePoint, 
 Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Register&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Tagprefix&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Utilities&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Namespace&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.SharePoint.Utilities&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Assembly&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.SharePoint, 
 Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Register&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Tagprefix&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;asp&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Namespace&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;System.Web.UI&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Assembly&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;System.Web.Extensions, 
 Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Import&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Namespace&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.SharePoint&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Assembly&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;Microsoft.Web.CommandUI, 
 Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;@&lt;/span&gt; &lt;span style=&quot;color:maroon&quot;&gt;Page&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Language&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;C#&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;AutoEventWireup&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;CodeBehind&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;ApplicationPage1.aspx.cs&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;Inherits&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;MyAppPage.Layouts.MyAppPage.ApplicationPage1&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;DynamicMasterPageFile&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;~masterurl/default.master&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;background: yellow; mso-highlight: yellow&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PageHead&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderAdditionalPageHead&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;Main&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;
 ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderMain&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;Hello World!&lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;PageTitle&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;
 ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderPageTitle&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;Application Page&lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;PageTitleInTitleArea&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;
 ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderPageTitleInTitleArea&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;My Application Page&lt;br /&gt;
 &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;(ok, the &quot;Hello World!&quot; is mine).  Now if you hit F5 or click Build -&gt; &quot;Deploy Solution&quot; then as I mentioned SharePoint packages up the application page into a wsp file and deployes it out to SharePoint.  Now if you navigate to your application page (in my case http://localhost/mysite/_layouts/MyAppPage/ApplicationPage1.aspx) then you should see something like this:&lt;/p&gt;

&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://1.bp.blogspot.com/_gez10dNhuPk/S6akgCoo_CI/AAAAAAAABsU/ccLTEAhinWQ/s1600-h/part2-4-helloworld.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 286px;&quot; src=&quot;http://1.bp.blogspot.com/_gez10dNhuPk/S6akgCoo_CI/AAAAAAAABsU/ccLTEAhinWQ/s400/part2-4-helloworld.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;Img3&quot; /&gt;&lt;/a&gt;

&lt;p&gt;Amazed?  You should be.  We didn't write a line of evil looking CAML, didn't have to write any DOS batch files, didn't have to deploy to the GAC, we probably didn't even notice that a feature.xml file was created behind the scenes.  Yet already we're deployed!  Ok, enough exuberance, back to business.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;No Really, Show Me the AJAX Templating Code&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Before writing code you should probably create some lists to read and write to.  As I mentioned in a previous post I like &lt;a href=&quot; http://rapidapplicationdevelopment.blogspot.com/2010/02/video-how-to-create-burndown-charts-for.html &quot;&gt;tracking user stories in SharePoint&lt;/a&gt;.  So for my examples I have an Iterations list and a User Stories list, which is based off of the Tasks content type (automatically giving you a number of columns like Priority).&lt;/p&gt;
&lt;p&gt;After creating some lists you need to ensure you have the latest &lt;a href=&quot; http://ajax.codeplex.com/releases/view/35895 &quot;&gt;ASP.Net Ajax Library&lt;/a&gt;.  I suspect an updated copy will be included with the RTM copy of SharePoint 2010, but in my case I downloaded the latest copy and moved the entire Scripts directory into C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ajax.  Note that out of the box SharePoint 2010 already included some of these files in LAYOUTS, but it was missing others, so this step was necessary.&lt;/p&gt;
&lt;p&gt;So here is the absolute simplest templating example that still works:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:maroon;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PageHead&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderAdditionalPageHead&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjax.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxDataContext.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxTemplates.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxAdoNet.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;Main&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;
 ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderMain&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
 function&lt;/span&gt; pageInit() {&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;var&lt;/span&gt; 
 dataContext = $create(Sys.Data.AdoNetDataContext, {
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;serviceUri:
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;/demoprep/_vti_bin/ListData.svc&amp;quot;&lt;/span&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;});&lt;br /&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$create(Sys.UI.DataView,
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;autoFetch:
 &lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dataProvider: 
 dataContext,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;fetchOperation:
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;UserStories&amp;quot;&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;fetchParameters: { 
 $top: 20 }&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;},&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;$get(&lt;span 
  style=&quot;color:maroon&quot;&gt;&amp;quot;userStoriesList&amp;quot;&lt;/span&gt;)&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;);&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
 Sys.Application.add_init(pageInit);&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;id&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;userStoriesList&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;class&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&amp;quot;sys-template&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span 
 style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&amp;#123;&amp;#123; Title &amp;#125;&amp;#125;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;li&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
  style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The four script references in the PageHead Content control are necessary to define the required ASP.Net AJAX JavaScript classes you'll need for templating.  But the Main content control is where things get interesting.&lt;/p&gt;
&lt;p&gt;Skip over the JavaScript for now and notice the unordered list named userStoriesList.  Inside of the li elements is a strange notation: &amp;#123;&amp;#123; Title &amp;#125;&amp;#125;.  This specifies a binding to the name of a SharePoint field.  You could also have put in PriorityValue or any of the other columns specified in the JSON that I showed in Part 1.&lt;/p&gt;
&lt;p&gt;As far as the JavaScript, the dataContext variable is a class of type AdoNetDataContext, which knows how to talk to WCF Data Services like ListData.svc.  It inherits from a JavaScript class called DataContext which is extensible and knows how to talk with other protocols, but us SharePoint developers probably won't care about this most of the time.&lt;/p&gt;
&lt;p&gt;The userStoriesTemplate variable is a class of type DataView.  This is where the magic happens.  DataViews pull data from a DataContext, duplicates the innerHtml of an associated DOM element for each row returned (e.g. userStoriesList), and replace the binding syntax with real data.  Seems simple enough, but it is actually quite sophisticated when you get to some more advanced scenarios that I'll describe later.&lt;/p&gt;
&lt;p&gt;One last thing to notice is the sys-template class.  This is a prespecified CSS class that ASP.Net AJAX sets to display: block when it is finished rendering.  It's a good idea to create a CSS class for sys-template with display: none so that end users don't see your template code while the page is loading.  Obviously you should do this in a separate CSS class in LAYOUTS or if you're lazy you can put it in the PageHead content control like so:&lt;/p&gt;

 &lt;p class=&quot;MsoNormal&quot;&gt;
  &lt;span style=&quot;font-size:
9.5pt;font-family:Consolas;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
font-family:Consolas;color:maroon&quot;&gt;STYLE&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
font-family:Consolas&quot;&gt; &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:maroon&quot;&gt;.sys-template&lt;/span&gt; { &lt;span style=&quot;color:red&quot;&gt;
  display&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;block&lt;/span&gt;; }&lt;br /&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;STYLE&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
   style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;ID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&amp;quot;PageHead&amp;quot;&lt;/span&gt; &lt;span style=&quot;color:red&quot;&gt;
  ContentPlaceHolderID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;PlaceHolderAdditionalPageHead&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjax.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxDataContext.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxTemplates.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;../ajax/MicrosoftAjaxAdoNet.js&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:maroon&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;STYLE&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;/span&gt;&lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;.sys-template&lt;/span&gt; { &lt;span style=&quot;color:red&quot;&gt;
  display&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;block&lt;/span&gt;; }&lt;br /&gt;
  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;STYLE&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:maroon&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;:&lt;/span&gt;&lt;span 
   style=&quot;color:maroon&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br 
   style=&quot;mso-special-character:line-break&quot; /&gt;
  &lt;![if !supportLineBreakNewLine]&gt;
  &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;
  &lt;![endif]&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
 &lt;/p&gt;

&lt;p&gt;So now if you click If you click Build -&gt; Deploy Solution you should see something like this:&lt;/p&gt;

&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6akgdn0DlI/AAAAAAAABsc/ePFlii5mG9o/s1600-h/part2-5-endresult.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 292px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6akgdn0DlI/AAAAAAAABsc/ePFlii5mG9o/s400/part2-5-endresult.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;Img1&quot; /&gt;&lt;/a&gt;

&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Ok, this isn't super exciting yet.  We certainly could have done this much easier with server side code.  But bear with me, this has a lot of potential.  For instance, how do you write data back to the server?  How do you really make it AJAXy?  I'll explore these questions in &lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html&quot;&gt;Part 3 - Writing data back to SharePoint with ASP.Net AJAX 4.0 Templates&lt;/a&gt; and subsequent posts in the series.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Client Side AJAX Applications in SharePoint 2010 - Part 1</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications.html</guid>
        <pubDate>Sun, 21 Mar 2010 18:37:06 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;If you haven't played with it yet, one of the things you'll immediately notice about SharePoint 2010 is that the UI is extremely AJAX centric.  For instance modifying or adding list items is either done in-line with partial page refreshes or via lightbox popups.  It's very pleasant to use.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2010/03/client-side-ajax-applications-in.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;


&lt;p&gt;One of the consequences of this Web 2.0 design is that the expectations of SharePoint end users will significantly increase.  No longer will long delays and/or full page refreshes in your SharePoint based custom applications be acceptable.  End users may not be able to clearly articulate it, but unless as developers we update our techniques to match the new technology our SharePoint based applications will begin to feel stale and will stick out from the rest of SharePoint 2010.&lt;/p&gt;
&lt;p&gt;Fortunately Microsoft has stepped up the support it offers Web 2.0 developers in a big way.  One of the most compelling features is in how SharePoint exposes all list data via REST/ATOM &lt;i&gt;and&lt;/i&gt; JSON.  This feature combined with the new templating feature of ASP.Net AJAX 4 allows developers to easily write fast, responsive user interfaces.  I will explore these two technologies in the following series:&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications.html&quot;&gt;Part 1 - Exploring WCF Data Services in SharePoint 2010&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html&quot;&gt;Part 2 - Creating a read-only page with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_2.html&quot;&gt;Part 3 - Writing data back to SharePoint with ASP.Net AJAX 4.0 Templates&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/aspajax_4_templates_part_4_-_j.html&quot;&gt;Part 4 - jQuery and Manual JSON Object Manipulation&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Why do we need yet another framework?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you attempt to develop Web 2.0 applications in SharePoint with the techniques you have today there are really only two approaches: ASP.Net AJAX and server side controls or manually coding JavaScript, probably with jQuery or other JavaScript Libraries.  If you take the ASP.Net AJAX approach you'll undoubtedly be using an UpdatePanel to get partial page refreshes and then writing ASP.Net code like you always have.  There are several problems with this approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It sends the entire ViewState with every asynchronous request - this can result in slow, unresponsive apps (this can actually sneak up on you once you have a lot of production data as happened to me recently)&lt;/li&gt;
&lt;li&gt;Even without a ViewState the UpdatePanel transmits large amounts of HTML (rather than lightweight JSON data)&lt;/li&gt;
&lt;li&gt;It runs through the entire page lifecycle on updates, executing everything on the page even if it isn't relevant to what you're doing&lt;/li&gt;
&lt;li&gt;ASP.Net AJAX doesn't have the simplicity of an ETag based HTTP caching like with a REST solution&lt;/li&gt;
&lt;li&gt;Finally SharePoint just doesn't work well with UpdatePanel, I can't tell you how many issues I've had with various controls not working out of the box&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you take the manual JavaScript rout you are faced with a number of different problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have to write &lt;i&gt;a lot&lt;/i&gt; of plumbing code&lt;/li&gt;
 &lt;ul&gt;
  &lt;li&gt;You have to write a service to return your data&lt;/li&gt;
  &lt;li&gt;You have to pay particular attention to security and permissions since you're exposing your API's to the world&lt;/li&gt;
  &lt;li&gt;You have to convert your data (ideally JSON) into HTML with probably string concatenation or document.createElement statements&lt;/li&gt;
 &lt;/ul&gt;
&lt;li&gt;Your UI code is not clearly separated from your data access code making your code hard to maintain&lt;/li&gt;
&lt;li&gt;Saving data back to the server involves even more plumbing code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SharePoint 2010 combined with ASP.Net AJAX 4.0 solves these problems.  It probably introduces new problems too, but I haven't run into too many thus far.  So over the next couple of posts I hope to convince you that we do need yet another web framework and that Microsoft is headed in a great direction with these technologies.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;So How Does it Work?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In WSS 3.0 you were able to access list data with the SOAP based Lists.asmx.  This technique worked well for .Net desktop apps or server side application pages, but not so well with client side JavaScript.  SharePoint 2010 exposes its list data with REST based ListData.svc (though WCF Data Services which I'll describe in more detail below).  Once you install &lt;a href=&quot; http://ajax.codeplex.com/releases/view/35895 &quot;&gt;WCF Data Services&lt;/a&gt; on a machine with SharePoint 2010 you can simply navigate to http://[server]/[optional site]/_vti_bin/ListData.svc and see all of the lists you have permission to access.  The result will look like this:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;xml&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt; &lt;/span&gt;
 &lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:red;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:
115%;font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;1.0&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;iso-8859-1&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
 &lt;span style=&quot;color:red&quot;&gt;standalone&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;yes&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;?&amp;gt;&lt;br /&gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
 &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;xml:base&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;http://localhost/mySite/_vti_bin/ListData.svc/&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;
 xmlns:atom&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;http://www.w3.org/2005/Atom&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;
 xmlns:app&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;http://www.w3.org/2007/app&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;
 &lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;xmlns&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;http://www.w3.org/2007/app&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;workspace&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;atom:title&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Default&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:#A31515&quot;&gt;atom:title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;collection&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Iterations&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;atom:title&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Iterations&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:#A31515&quot;&gt;atom:title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;collection&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;collection&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;UserStories&lt;/span&gt;&amp;quot;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;atom:title&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;UserStories&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
  style=&quot;color:#A31515&quot;&gt;atom:title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;collection&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;workspace&lt;/span&gt;&lt;span 
  style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;You can then append the names of lists (e.g. http://localhost/site/_vti_bin/ListData.svc/UserStories) and immediately view the list items in the list as an ATOM feed.  A typical result looks like this:&lt;/p&gt;

 &lt;p class=&quot;MsoNormal&quot;&gt;
  &lt;span style=&quot;font-size:
9.5pt;font-family:Consolas;color:blue&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
font-family:Consolas;color:#A31515&quot;&gt;xml&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
font-family:Consolas;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;font-size:9.5pt;
font-family:Consolas;color:red&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
font-family:Consolas;color:blue&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-size:9.5pt;
font-family:Consolas&quot;&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;1.0&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;iso-8859-1&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;standalone&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;yes&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;?&amp;gt;&lt;br /&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;feed&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;xml:base&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://localhost/mySite/_vti_bin/ListData.svc/&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;xmlns:d&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;xmlns:m&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/metadata&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://www.w3.org/2005/Atom&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;text&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;UserStories&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;title&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;http://localhost/mySite/_vti_bin/ListData.svc/UserStories&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;id&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;updated&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2010-03-20T02:20:26Z&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;updated&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;self&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;entry&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;m:etag&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;W/&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;&amp;amp;quot;&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;&amp;amp;quot;&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;http://localhost/mySite/_vti_bin/ListData.svc/UserStories(2)&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;id&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;text&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Blah&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;title&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;updated&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2010-03-19T15:13:28-05:00&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;updated&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;author&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;author&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;edit&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStoriesItem&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories(2)&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/related/Predecessors&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;application/atom+xml;type=feed&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Predecessors&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories(2)/Predecessors&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/related/Priority&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;application/atom+xml;type=entry&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Priority&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories(2)/Priority&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; 
  /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/related/Status&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;application/atom+xml;type=entry&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Status&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories(2)/Status&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/related/Iteration&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;application/atom+xml;type=entry&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Iteration&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories(2)/Iteration&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; 
  /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;link&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;rel&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/related/Attachments&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;application/atom+xml;type=feed&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Attachments&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;href&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;UserStories(2)/Attachments&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;category&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;term&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Microsoft.SharePoint.DataService.UserStoriesItem&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;
  &lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;scheme&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/scheme&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;application/xml&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;m:properties&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:ContentTypeID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;0x01080070E2807D369BD94FBD6C057D3110E6D3&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:ContentTypeID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Title&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Do 
  Something&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Title&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:PriorityValue&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;(2) Normal&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:PriorityValue&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:StatusValue&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Not Started&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:StatusValue&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Complete&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.Double&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;m:null&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;true&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:AssignedToID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:null&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:TaskGroupID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:null&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Description&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;&amp;amp;lt;&lt;/span&gt;div&lt;span 
   style=&quot;color:red&quot;&gt;&amp;amp;gt;&amp;amp;lt;&lt;/span&gt;/div&lt;span style=&quot;color:red&quot;&gt;&amp;amp;gt;&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Description&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:StartDate&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.DateTime&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2010-02-20T00:00:00&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:StartDate&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:DueDate&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.DateTime&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;m:null&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;true&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Points&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.Double&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;3&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Points&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:IterationID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;3&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:IterationID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:ID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;
  &lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:ID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:ContentType&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Task&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:ContentType&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Modified&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.DateTime&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2010-03-19T15:13:28&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Modified&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Created&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;Edm.DateTime&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2010-02-20T15:32:26&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Created&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:CreatedByID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;1&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:CreatedByID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:ModifiedByID&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;1&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:ModifiedByID&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Owshiddenversion&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;m:type&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color:blue&quot;&gt;Edm.Int32&lt;/span&gt;&amp;quot;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;3&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;d:Owshiddenversion&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Version&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;3.0&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Version&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
  &amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Path&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;/mySite/Lists/User 
  Stories&lt;span style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;d:Path&lt;/span&gt;&lt;span 
   style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:
#A31515&quot;&gt;m:properties&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span 
   style=&quot;color:#A31515&quot;&gt;entry&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;
  &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;feed&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br 
   style=&quot;mso-special-character:line-break&quot; /&gt;
  &lt;![if !supportLineBreakNewLine]&gt;
  &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;
  &lt;![endif]&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
 &lt;/p&gt;

&lt;p&gt;You can append various parameters to filter, sort, or paginate your data from this page.  For example http://localhost/site/_vti_bin/ListData.svc/UserStories?$filter=(PriorityValue eq '(2) Normal')&amp;$orderby=Title will return list items whose priority is normal sorted by title.  See &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc668784.aspx &quot;&gt;Query Expressions&lt;/a&gt; on MSDN for more details.&lt;/p&gt;

&lt;p&gt;Now if you're interested you can take it a step further by viewing the data as JSON.  To do this you'll need to modify the HTTP headers.  Fortunately there is a tool from Microsoft for viewing, replaying, and modify HTTP sessions called &lt;a href=&quot;http://www.fiddler2.com/fiddler2/ &quot;&gt;Fiddler&lt;/a&gt;.  After you install it open Fiddler from the add-in in your web browser (I used IE, but Firefox should work too).  Then refresh the web page for a list (in my case ListData.svc/UserStories).  Now in Fiddler drag the last request to the Request Builder, ensure &quot;Automatically Authenticate&quot; is checked in options, and replace &quot;Accept: */*&quot; with &quot;Accept application/json&quot;. When you click Execute you should see something like:&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:9.5pt;line-height:115%;
font-family:Consolas;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA&quot;&gt;{&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt; : {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;results&amp;quot;&lt;/span&gt;: [&lt;br /&gt;
 {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__metadata&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(2)&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;etag&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;W/\&amp;quot;3\&amp;quot;&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;type&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;Microsoft.SharePoint.DataService.UserStoriesItem&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ContentTypeID&amp;quot;&lt;/span&gt;:
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;0x01080070E2807D369BD94FBD6C057D3110E6D3&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Blah&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Predecessors&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(2)/Predecessors&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}&lt;br /&gt;
 }, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Priority&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(2)/Priority&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}&lt;br /&gt;
 }, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;PriorityValue&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;(2) Normal&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Status&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(2)/Status&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}&lt;br /&gt;
 }, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;StatusValue&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;Not Started&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Complete&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:
blue&quot;&gt;null&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;AssignedToID&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;TaskGroupID&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Description&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;StartDate&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;\/Date(1266624000000)\/&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;DueDate&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Points&amp;quot;&lt;/span&gt;: 3,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Iteration&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(2)/Iteration&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}&lt;br /&gt;
 }, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;IterationID&amp;quot;&lt;/span&gt;: 3,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;: 2,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ContentType&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;Task&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Modified&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:
maroon&quot;&gt;&amp;quot;\/Date(1269011608000)\/&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Created&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;\/Date(1266679946000)\/&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;CreatedByID&amp;quot;&lt;/span&gt;: 1,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;ModifiedByID&amp;quot;&lt;/span&gt;: 1,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Owshiddenversion&amp;quot;&lt;/span&gt;: 3,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Version&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;3.0&amp;quot;&lt;/span&gt;,
 &lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Attachments&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;__deferred&amp;quot;&lt;/span&gt;: {&lt;br /&gt;
 &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;uri&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;http://localhost/demoprep/_vti_bin/ListData.svc/UserStories(2)/Attachments&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}&lt;br /&gt;
 }, &lt;span style=&quot;color:maroon&quot;&gt;&amp;quot;Path&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color:maroon&quot;&gt;
 &amp;quot;/demoprep/Lists/User Stories&amp;quot;&lt;br /&gt;
 &lt;/span&gt;}&lt;br /&gt;
 ]&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br style=&quot;mso-special-character:line-break&quot; /&gt;
 &lt;![if !supportLineBreakNewLine]&gt;
 &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;
 &lt;![endif]&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;
&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6YnvZgs-4I/AAAAAAAABr0/lFSbUWxfsAc/s1600-h/Fiddler.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 191px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/S6YnvZgs-4I/AAAAAAAABr0/lFSbUWxfsAc/s400/Fiddler.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5451088094233951106&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;That's SharePoint data as JavaScript Object Notation.  Notice the etag and href's to associated list data.  Cool.&lt;/p&gt;

&lt;p&gt;But ListData.svc isn't just for reading data.  To experiment with it try deleting a list item.  To do this in fiddler set the HTTP verb to &quot;DELETE&quot;, set the URL to a particular list item's URL (e.g. http://localhost/site/_vti_bin/ListData.svc/UserStories(2) where 2 is the ID for a list item), leave Request Headers empty, and hit Execute.  Refresh the list of items and yours is gone.  Permanently.  The item isn't even in the recycle bin.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Security in WCF Data Services&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So at this point you are undoubtedly concerned about security.  Just to give some background ListData.svc is provided by a technology called &lt;a href=&quot;http://en.wikipedia.org/wiki/ADO.NET_Data_Services&quot;&gt;WCF Data Services&lt;/a&gt;, which was formerly called ADO.Net Data Services, which was code named Astoria.  And WCF Data Services is an implementation of the open data protocol (OData) which &lt;a href=&quot; http://www.hanselminutes.com/default.aspx?showID=223 &quot;&gt;Scott Hanselman&lt;/a&gt; has an excellent podcast about.&lt;/p&gt;
&lt;p&gt;This technology was originally designed for exposing database data.  And in this scenario you do have to handle your own security.  SharePoint 2010, however, takes things a step further by giving you WCF Data Services (nearly) out of the box while also handling your authorization security.&lt;/p&gt;
&lt;p&gt;For instance if you modify the row level permissions for a list item to deny read permissions to a user then ListData.svc will not return that list item for that user.  If you try to access the URL for that list item directly SharePoint returns a 404.  If you try to modify or delete a list item you don't have permissions to modify then SharePoint returns a 401 Unauthorized.&lt;/p&gt;
&lt;p&gt;Very cool.  I find this especially nice because you don't have to worry about maintaining your security code.  It's intimately tied to SharePoint 2010's security model which is already quite sophisticated.&lt;/p&gt;
&lt;p&gt;Incidentally, security is not all that's included when you use these services.  SharePoint also performs data validation and returns the appropriate HTTP error codes if you for instance violate the new uniqueness constraint.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;SharePoint offers everything you've seen so far (nearly) out of the box and without a line of code.  This sets the stage for writing some nice client side applications with technologies like ASP.Net AJAX 4.0 client site templating.  Which is exactly what I intend to do in &lt;a href=&quot;http://www.nearinfinity.com/blogs/lee_richardson/client_side_ajax_applications_1.html&quot;&gt;Part 2 - Creating a read-only page with ASP.Net AJAX 4.0 Templates&lt;/a&gt;.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>[video] How To Create Burndown Charts For User Stories in SharePoint</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/video_how_to_create_burndown_c.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/video_how_to_create_burndown_c.html</guid>
        <pubDate>Fri, 12 Feb 2010 16:46:16 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description> &lt;p&gt;I love tracking user stories in SharePoint.  It's free (assuming you have access to a Windows Server 2003 or 2008 machine with WSS turned on) and is extremely flexible.  Adding new custom columns is easy.  Adding custom views is easy.  Bulk editing is amazingly simple and powerful (assuming you're willing to use IE).  And building a custom home page &quot;portal&quot; with all the states of your team's workflow (e.g. unassigned, stories I'm working on, my resolved stories, to peer test, etc) is easy and is intuitive to use.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2010/02/video-how-to-create-burndown-charts-for.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;This 13 minute screencast shows you how to create a user stories list in SharePoint and build burn up and burn down charts off of the data using Microsoft Excel.  It includes the custom fields you'll need in SharePoint, the formula's you'll have to create in Excel, and shows tips along the way like how to simplify refreshing your reports when data changes.&lt;/p&gt;

&lt;object width=&quot;580&quot; height=&quot;435&quot;&gt;&lt;param name=&quot;allowfullscreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://vimeo.com/moogaloop.swf?clip_id=9404991&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=e97000&amp;amp;fullscreen=1&quot; /&gt;&lt;embed src=&quot;http://vimeo.com/moogaloop.swf?clip_id=9404991&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=e97000&amp;amp;fullscreen=1&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; allowscriptaccess=&quot;always&quot; width=&quot;580&quot; height=&quot;435&quot;&gt;&lt;/embed&gt;&lt;/object&gt;

&lt;p&gt;Once you've watched the screencast if you want to implement this yourself here is the information you'll need:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Custom SharePoint Columns&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Iteration (Choice column e.g. Iteration00, Iteration01, zBacklog)&lt;/li&gt;
&lt;li&gt;Released (Date - the date the iteration was closed out)&lt;/li&gt;
&lt;li&gt;Points (Number)&lt;/li&gt;
&lt;li&gt;Created Date (for demo only, you should be able to use &quot;Created&quot; on your project)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;Calculated Columns in Excel&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total Points to Date
  &lt;ul&gt;
  &lt;li&gt;The total points on a specific date including backlog, current iteration and all completed stories&lt;/li&gt;
  &lt;li&gt;=SUMIF([Created Date],CONCATENATE(&quot;&lt;=&quot;,Table_owssvr_1[[#This Row],[Released]]),[Points])&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Completed To Date
  &lt;ul&gt;
  &lt;li&gt;Total points for stories released prior to current story's release date&lt;/li&gt;
  &lt;li&gt;=SUMIF([Released],CONCATENATE(&quot;&lt;=&quot;,Table_owssvr_1[[#This Row],[Released]]),[Points])&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Backlog
  &lt;ul&gt;
  &lt;li&gt;What remains to be completed at a point in time (e.g. don't include user stories added to the backlog in iteration 4 if this is for a task in iteration 03)&lt;/li&gt;
  &lt;li&gt;=Table_owssvr_1[[#This Row],[Total Points to Date]]-Table_owssvr_1[[#This Row],[Completed to Date]]&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;Burndown Pivot Table Values&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Row: Released&lt;/li&gt;
&lt;li&gt;Filter: Released After [Some Date]&lt;/li&gt;
&lt;li&gt;Values: Max(Backlog)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;Burnup Pivot Table Values&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Row: Released&lt;/li&gt;
&lt;li&gt;Filter: Released After&lt;/li&gt;
&lt;li&gt;Values
  &lt;ul&gt;
  &lt;li&gt;Max(Total Points to Date)&lt;/li&gt;
  &lt;li&gt;Max(Completed To Date)&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I hope you found the presentation useful and if you are currently using SharePoint for tracking user stories please comment on your experiences.&lt;/p&gt; 
</description>
        
          <category term="agile" label="agile"/>
        
          <category term="development" label="development"/>
        
      </item>
    
      <item>
        <title>Business Process Modeling for Software Developers</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/business_process_modeling_for.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/business_process_modeling_for.html</guid>
        <pubDate>Wed, 23 Dec 2009 09:01:57 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;As a software developer I never thought I'd be saying this (I suppose eight years of working for the company that invented this technique might bias me), but you can not underestimate the value of business process modeling when starting a new project.  This is especially true if it's a small project and you don't have the benefit of a dedicated requirements analyst.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/12/business-process-modeling-for-software.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;As a consultant (or as a person who is learning someone else's business) your job is to understand your customers existing business &lt;i&gt;better than they do themselves&lt;/i&gt;.  And you need to be on the same page with others regarding how you are going to change their day to day functions.  And that's what business process modeling is for.&lt;/p&gt;

&lt;p&gt;You may ignore this document after the first week on the project, in fact I would encourage you to. But even if you throw it away immediately after creating it, the process of developing the document will still:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flush out important questions&lt;/li&gt;
&lt;li&gt;Show your customer you understand their world&lt;/li&gt;
&lt;li&gt;Help document the project to other developers&lt;/li&gt;
&lt;li&gt;Facilitate communication (especially with the people who pay the bills)&lt;/li&gt;
&lt;li&gt;Generate user stories (requirements) &lt;/li&gt;
&lt;li&gt;Identify the entities that can feed into an &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/06/entity-relationship-diagram-example.html&quot;&gt;Entity Relationship Diagram&lt;/a&gt; (or database I suppose)&lt;/li&gt;
&lt;li&gt;Aid making good choices for the decisions it be hard to undo later (like whether to manually code workflows or use &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Workflow_Foundation&quot;&gt;Windows Workflow Foundation&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;More clearly identify pain points and areas where your software can help end users; and&lt;/li&gt;
&lt;li&gt;Identify metrics that can help determine project success from an ROI and product owner's perspective&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Convinced this is a tool you need in your toolbelt yet?  As long as the answer isn't &quot;I only write code leave me alone&quot; then check out this quick how-to:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Start with the AS-IS diagram&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;As soon as possible on a new project you should plan to interview your future end users.  This shouldn't be an unstructured Q&amp;amp;A session.  You should start with a rough draft of what you think their business process is and ask questions that identify the places where you were wrong.&lt;p&gt;

&lt;p&gt;In order to start the diagram you need to identify both the end users and existing systems and put those in &quot;swimlanes&quot; down the left side of a diagram.  Swimlanes are important because they help you be explicit about who is performing what activities.  Then flush out activities in the happy path in appropriate swimlanes like so:&lt;/p&gt;
 
&lt;p&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SzISYvjEwvI/AAAAAAAABrg/8X9h_xxiDvw/s1600-h/AS-IS.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 344px;&quot; src=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SzISYvjEwvI/AAAAAAAABrg/8X9h_xxiDvw/s400/AS-IS.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5418413517969867506&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
 
&lt;p&gt;As soon as you talk to end users (like the clerk in the example above) you will discover unhappy paths.  What if the warehouse is out of a product?  What if the payment was declined?  What happens if a customer needs to return something?&lt;/p&gt;

&lt;p&gt;Obviously you document these using standard activity diagram notation:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SzISZP5NmgI/AAAAAAAABro/Q6AeYSTx7eo/s1600-h/Choice.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 389px; height: 400px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SzISZP5NmgI/AAAAAAAABro/Q6AeYSTx7eo/s400/Choice.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5418413526652656130&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Identifying Pain Points/Opportunities&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The interesting part about unhappy paths is how often they occur, how they affect the customers of your customer, and ultimately how they affect your customer's bottom line.  For instance, how often is payment declined in the example above?  Fairly frequently?  Can you get an actual percentage?  If it turns out it's because the original application failed to validate credit cards, then a small amount of programming effort can provide a large benefit to length of time until order fulfillment.  Sometimes you can make the process more efficient without writing a line of code.&lt;/p&gt;

&lt;p&gt;And at the end of your project if you can show that you've decreased the average length of time it takes to go through the process, ideally by showing less time was spent in unhappy paths, you will likely have made yourself one happy customer.  This can be especially effective if your new system can show statistics (like percent of orders that are declined) and compare those to the old process.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Developing the TO-BE diagram&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;AS-IS process diagrams are completely useless unless you can effectively describe what the process will look like after you implement your new system.  The process of developing these documents is pretty similar to the AS-IS diagram except of course you're trying to fix the pain points.&lt;/p&gt;

&lt;p&gt;One technique I like for generating a backlog of user stories (tasks) is to put unique numbers with each step in the TO-BE process, then ensure there is at least one user story per step in the process.  You may be surprised at how easily activities in your new project's swimlane map to user stories.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I'm a fan of writing code as soon as possible on a project, but if you fail to understand an end user's business process you may be writing the wrong code.  Business process modeling can ensure you're writing the right code to solve the most important problems first.  And that may be the difference between project success and project failure.&lt;/p&gt; 
</description>
        
          <category term="agile" label="agile"/>
        
          <category term="development" label="development"/>
        
      </item>
    
      <item>
        <title>Ruby on Rails, a Microsoft Developer's Perspective</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/ruby_on_rails_a_microsoft_deve.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/ruby_on_rails_a_microsoft_deve.html</guid>
        <pubDate>Wed, 18 Nov 2009 10:42:15 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I suppose I'm a pretty hard core Microsoft developer.  I've been doing Microsoft .Net C# development since the .Net framework was first released in 2002.  Before that, starting in 1997 about when the technology was first released, I developed in Visual Basic with classic ASP (Active Server Pages).  So that's twelve years of Microsoft development all told.  Which is why the Ruby on Rails class I've been taking this week is so interesting.  Ruby represents a significant branching out for me.  So these are my initial impressions.  I am a complete Ruby neophyte, so please keep all flames at least friendly in tone :).&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/11/ruby-on-rails-microsoft-developers.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Dynamic Typing&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Let's get to the heart of this Ruby stuff.  I thought I would passionately hate dynamic typing.  I was getting ready to fill pages ranting about its evils.  But that moment never came.  Don't get me wrong the Visual Studio strongly typed intellisense no-reading-documentation-needed experience is far nicer than the NetBeans look-it-up-in-irb-with-.methods experience.  But the feeling was more like mild to moderate annoyance rather than unbridled hatred.  Like when I mistyped a variable and Ruby decided it was a new variable initialized as nil.  Annoying, and hard to track down, but hey I'm a Ruby newbie, experts probably don't make these mistakes, right?  Anyway, I would be interested to hear how non-trivial, well tested applications perform with refactoring (e.g. variables/fields in views?) and how bad things get during O&amp;amp;M.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Speed of Development&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I figured speed of development would be Ruby's saving grace.  It was that and more.  The Ctrl-S-Alt-Tab-Ctrl-R-zero-delay development cycle is frickin' amazing!  It made development feel more fun than it has in a long time.  Part of that may be the slower-than-molasses-in-December speed of development I experience today on my (not 2010) SharePoint project.  Regardless, even if I were working in an ASP.Net MVC project I suspect the extra speed of development in Rails by skipping the main compilation and JIT compilation steps would increase the enjoyment of a Ruby project enough to equal out the lack of strong typing.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Active Record vs LINQ&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Perhaps I'm just not experienced enough with active record, but to me the syntax feels contrived, non-intuitive, and just kind of agitating.  I mean it's cool that you can write &lt;/p&gt;
&lt;p&gt;&lt;code style=&quot;color: black&quot;&gt;p = Person.find_all_by_first_name_and_last_name(&quot;Lee&quot;, &quot;Richardson&quot;)&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;Ugly as sin, but cool.  The alternative doesn't feel much better: &lt;/p&gt;
&lt;p&gt;&lt;code style=&quot;color: black&quot;&gt;p = Person.all(:conditions =&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ :first_name =&gt; &quot;Lee&quot;, :last_name =&gt; &quot;Richardson&quot; })&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;Uch.  Of course I am biased.  I'm passionate about LINQ.  I love LINQ more than any single feature in Microsoft development.  I think LINQ may be the most brilliant stroke of genius Microsoft (Anders Hejlsberg) has ever had.  And I don't think I realized how passionately I felt about the technology until I didn't have it.  So for me I'll stick with:&lt;/p&gt;
&lt;p&gt;&lt;code style=&quot;color: black&quot;&gt;Person p = ctx.People.Where(p =&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.FirstName == &quot;Lee&quot; &amp;&amp; p.LastName == &quot;Richardson&quot;);&lt;/code&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;&lt;b&gt;Duck Typing&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;My mind was blown when the instructor showed us polymorphism without inheritance.  I can't argue about how incredibly powerful it is.  I just cringe to think of the potential misuse.  But without any real Ruby experience I'll have to just leave it at &quot;Wow!&quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Mocking&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It's pretty scary that you can override the functionality of any method anywhere in Ruby.  But when the instructor showed us overriding DateTime.now for the purposes of mocking I had an &quot;ah ha!&quot; moment.  Mocking DateTime.Now in C# is an awful experience that involves an intermediate class with a virtual &quot;Now()&quot; method.  Ruby sure got C# on that one.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;YAML&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It's no secret that I passionately hate XML.  And it's no secret that Microsoft passionately loves XML.  Pity about the mismatch.  Ruby on Rails really endeared itself to me when its designers recognized that XML is a travesty against humanity and used &lt;a href=&quot;http://en.wikipedia.org/wiki/Yaml&quot;&gt;YAML Ain't Markup Language&lt;/a&gt; instead.  Nice!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Interactive Ruby Console&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The Interactive Ruby Console (IRB) is just wonderful.  Now I can at least get that functionality today in C# with &lt;a href=&quot;http://www.nearinfinity.com/blogs/joe_ferner/&quot;&gt;Joe Ferner's&lt;/a&gt; excellent &lt;a href=&quot;http://devtoolbox.codeplex.com/&quot;&gt;Developer's Toolbox&lt;/a&gt;.  What I can't get is the Interactive Rails Console (ruby script/console).  Now that is awesome.  I can't wait for C# 4.0 which I suspect will have this.  For now RoR++, C#-- .&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Tooling&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I'm not sure how related this is to dynamic typing, but surprisingly I really, really missed Visual Studio.  Perhaps RubyMine is better that NetBeans.  I sure wasn't impressed with Komodo.  I just felt like constantly switch between my IDE and various console windows, and a database viewer felt clumsy yet somehow necessary with Rails.  It just felt so 1999.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;There's no doubt about it, I could be very happy on a Ruby project.  The no XML thing is just a perk, the fast development cycles and bringing fun back to coding again is truly awesome.  But am I ready to give up Microsoft development full time just yet?  No way.  LINQ, strong typing, and believe it or not Visual Studio tip the scales back to about equal.  Now if only Microsoft could somehow make compilation instantaneous.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>SharePoint 2010 Expectations Meet Reality</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/sharepoint_2010_expectations_m.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/sharepoint_2010_expectations_m.html</guid>
        <pubDate>Sat, 24 Oct 2009 01:26:55 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;The current version of SharePoint and I have a love hate relationship.  Since I want to be able to look forward to a more joyful and fulfilling relationship with the tool/platform, I made a list of my biggest frustrations before I left for the SharePoint 2010 conference (&lt;a href=&quot;http://www.bing.com/twitter/search?q=%23spc09&amp;form=QB &quot;&gt;#spc09&lt;/a&gt;).  My objective was to return with most of the items checked off as resolved and to have a bunch of new functionality that I hadn't realized I needed.  SharePoint 2010 easily fulfils the second promise with stuff like Business Data Services (Awesome!) and Visio Data Services (Amazing!).  But I don't want to try to recap the whole conference so here's just how it compares to my initial list:&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/10/sharepoint-2010-expectations-meet.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Testability&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;SharePoint is &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2009/08/sharepoint-wild-west-of-software.html&quot;&gt;notoriously hard to unit test&lt;/a&gt;.  The good news is Microsoft provided a whole session devoted to software development best practices that included a good chunk on unit testing.  It was wonderful to see!&lt;/p&gt;
&lt;p&gt;The bad news: SharePoint 2010 will not have public constructors and classes will still be sealed (final).  The good news to the bad news: After discussing this issue with Chris Keyser I discovered that Peli de Halleux of Microsoft Research has a free tool called &lt;a href=&quot;http://research.microsoft.com/en-us/projects/pex/default.aspx&quot;&gt;Pex&lt;/a&gt; that solves the whole problem.  It allows what it calls detours, which allow you to mock non-virtual methods.  This stuff is amazing and I'll blog more about it later.&lt;/p&gt;
&lt;p&gt;Summary: Testability is better even for existing SharePoint installs -- so between &lt;a href=&quot; http://sporm.codeplex.com/&quot;&gt;Sporm&lt;/a&gt; and Pex this is a non-issue -- I'm happy.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;No Referential Integrity&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It kills me that if you create an employee list item that references a company list item and you delete the company list item then nothing happens.  No cascading delete.  No error message.  Just an orphan record.  SharePoint 2010 now supports both true referential integrity through errors and cascading deletes!&lt;/p&gt;
&lt;p&gt;Summary: Awesome!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Validation is Terrible&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Ever tried to validate by pattern in SharePoint (e.g. social security number)?  How about range validate (e.g. date of birth can't be after today)?  Or maybe validate one field against another?  The answer is you can't.  Not easily or consistently.  If you handle validation in an event receiver then the user doesn't get the error until after a postback on a separate page.  And custom field controls are a lot of work and they don't work in datasheet view.&lt;/p&gt;
&lt;p&gt;SharePoint 2010 mostly solves these validation issues by allowing field level and list level validation.  The error messages even show in datasheet view.  The bad news is that pattern matching is not currently supported (e.g. you can't validate social security number).&lt;/p&gt;
&lt;p&gt;Summary: Good stuff, need to see the final version to be extremely happy.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Poor Documentation&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Ever noticed that blogs give you better details on SharePoint APIs than MSDN does?  I don't even bother looking on MSDN for SharePoint content anymore.  Since the hands on labs didn't contain any documentation I'll have to refer to what Steve Ballmer said during the Q&amp;A session, which was that better documentation will be a priority.&lt;/p&gt;
&lt;p&gt;Summary: high hopes, but TBD.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Views Don't Allow Precedence&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you've ever needed a view with A and (B or C) and ended up with (A and B) or C, you know where I'm coming from.  As a developer you can implement precedence in CAML, but as an end user you're stuck.  Sadly this issue is still not fixed in SharePoint 2010.&lt;/p&gt;
&lt;p&gt;Summary: Fail.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Re-Deployment is Hard&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Currently redeploying lists is hard; redeploying web parts without overwriting user settings is hard; and redeploying workflows is very hard.&lt;/p&gt;
&lt;p&gt;Without documentation and intermittent Internet &lt;a href=&quot;http://www.nearinfinity.com/blogs/joe_ferner/&quot;&gt;Joe Ferner&lt;/a&gt; and I had a hard time manually confirming that this is better.  We also missed a key session on Thursday that talked about it.  There were some tweets that looked promising, but I'll have to wait until Thursday's presentations are posted to be able to comment for sure.&lt;/p&gt;
&lt;p&gt;Summary: Good I think, but still TBD.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Massive Duplication in CAML Instantiated Lists&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Using CAML to instantiate a list is currently awful in SharePoint.  It's like 5 pages of CDATA and HTML and XML with massive duplication.  Sadly SharePoint 2010 doesn't solve the root problem: list instantiation looks exactly the same.  The good news is that along with just about every other aspect of SharePoint 2010 development, Visual Studio makes this task mind numbingly easy to do.  If you can just try not to look in that file that was auto-generated for you, then you should be fine.&lt;/p&gt;
&lt;p&gt;Summary: Better.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Poor Usability&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Once you get used to the current version of SharePoint the user interface is extremely consistent and many users really like it.  But if you were to compare it to any modern Web 2.0 site it's a complete failure.  SharePoint 2010 does an excellent job of implementing selective refresh/AJAX/Web 2.0.  But to me it feels more complicated.  Maybe this is because it introduces the ribbon, which I have never liked.  Maybe it just is more complicated.  In any event I'm not the best judge of usability, so I'll have to wait and see what others say.&lt;/p&gt;
&lt;p&gt;Summary: Definitely better, but jury's still out.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Can't Reference a List &lt;i&gt;AND&lt;/i&gt; Content Type&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Suppose you have a Calendar list.  The list supports two content types: Events, and Iterations (sprints).  It's a nice architecture because you want to view iterations and events in the same calendar views.  Now if you have a User Story list, wouldn't it be nice to have a lookup field that points only to Iterations?  Sadly you couldn't do this before and you won't be able to for the foreseeable future.&lt;/p&gt;
&lt;p&gt;Summary: Fail.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;CAML for Queries&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Technically this wasn't on my list because I use &lt;a href=&quot;http://sporm.codeplex.com&quot;&gt;Sporm&lt;/a&gt;, but on behalf of my non-spormified software development brethren let me say that writing &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2009/09/sporm-out-of-depths-of-sharepoints-xml.html&quot;&gt;queries in CAML is awful&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;SharePoint 2010 makes enormous strides in this area.  I won't go into great detail, but you can now use LINQ on the server side &lt;i&gt;and on the client side&lt;/i&gt;!&lt;/p&gt;
&lt;p&gt;Summary: Awesome!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Lots of TBD, lots of awesomeness, still some fail.  Worth upgrading?  Absolutely.  Will it still be a love hate relationship?  Probably, but at the moment it's looking pretty darn good.&lt;/p&gt; 
A list of ten current SharePoint failures (such as bad testability, lack of referential integrity, poor usability, etc), and how SharePoint 2010 resolves or fails to resolve each one.
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Sporm - Out of the Depths of SharePoint's XML Hell</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/sporm_-_out_of_the_depths_of_s.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/sporm_-_out_of_the_depths_of_s.html</guid>
        <pubDate>Sun, 13 Sep 2009 21:10:03 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;In my last post I described how a new open source tool called &lt;a href=&quot;http://sporm.codeplex.com/&quot;&gt;sporm&lt;/a&gt; significantly simplifies &lt;a href=&quot; http://rapidapplicationdevelopment.blogspot.com/2009/09/unit-testing-sharepoint-past-present.html&quot;&gt;unit testing SharePoint&lt;/a&gt;.  Making SharePoint unit testable is my absolute favorite feature of sporm because SharePoint is notoriously hard to unit test.  But sporm provides other benefits as well and its ability to pull us out of the depths of verbose loosely typed XML hell and into LINQ excellence is next on my list of favorite features.  So in this post I'll describe the pre-sporm technique of querying with CAML, how to query data using sporm, and finally how sporm supports SharePoint's unique architecture of allowing multiple content types per list and what that means to you.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Caml's Are Ugly&lt;/b&gt;&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/09/sporm-out-of-depths-of-sharepoints-xml.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;&lt;i&gt;Warning: if you're new to SharePoint then what you're about to see may shock and upset you.  If, like me, you hate both XML and loose typing then you will agree that CAML is awful, but bear with me I promise sporm will make it better.  Much better.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;CAML or Collaborative Application Markup Language is how one queries for data in SharePoint.  A simple query might look like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;Query&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;Where&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;And&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;And&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;Eq&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#A31515;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;FieldRef&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:red;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;#39;&lt;span style=&quot;color:blue&quot;&gt;First_Name&lt;/span&gt;&amp;#39;&lt;span             style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:red&quot;&gt;Type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;#39;&lt;span             style=&quot;color:blue&quot;&gt;Text&lt;/span&gt;&amp;#39;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Lee&lt;span             style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Value&lt;/span&gt;&lt;span             style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;Eq&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;BeginsWith&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;FieldRef&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;#39;&lt;span             style=&quot;color:blue&quot;&gt;Last_Name&lt;/span&gt;&amp;#39;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:red&quot;&gt;Type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;#39;&lt;span             style=&quot;color:blue&quot;&gt;Text&lt;/span&gt;&amp;#39;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;Rich&lt;span             style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Value&lt;/span&gt;&lt;span             style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;BeginsWith&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;And&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Leq&lt;/span&gt;&lt;span             style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;FieldRef&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;#39;&lt;span             style=&quot;color:blue&quot;&gt;Dob&lt;/span&gt;&amp;#39;&lt;span style=&quot;color:blue&quot;&gt; /&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span             style=&quot;color:#A31515&quot;&gt;Value&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:red&quot;&gt;Type&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;=&lt;/span&gt;&amp;#39;&lt;span             style=&quot;color:blue&quot;&gt;DateTime&lt;/span&gt;&amp;#39;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;/span&gt;2009-01-01T00:00:00Z&lt;span             style=&quot;color:blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Value&lt;/span&gt;&lt;span             style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Leq&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;And&lt;/span&gt;&lt;span            style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Where&lt;/span&gt;&lt;span             style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;Query&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;&amp;gt;&lt;br             style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;Simple right?  ;) In case you didn't catch the meaning from the slightly, uh verbose, query this asks for records with a First_Name of &quot;Lee&quot;, a Last_Name starting with &quot;Rich&quot; and a &quot;Dob&quot; less than or equal January 1 2009.&lt;/p&gt;

&lt;p&gt;There are a couple of things to note about this query:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Field names are loosly typed.  If Dob were ever renamed to DateOfBirth the query would fail at runtime (probably during a demo to a customer, or if you're lucky during integration tests), but certainly not at compile time.&lt;/li&gt;
&lt;li&gt;And is a binary operator.  This forces explicit precedence and removes the need for parenthesis, but at the cost of readability.&lt;/li&gt;
&lt;li&gt;Types must be explicitly defined.  I guess this is necessary since it's XML, but somehow I just don't feel like this should be necessary.&lt;/li&gt;
&lt;li&gt;It's XML.  Ok obviously, but the point is you have to type everything twice.  &amp;lt;BeginsWith&amp;gt; &amp;lt;/BeginsWith&amp;gt;.  Ouch, so verbose, so angley, I so hate XML.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, there are tools that make this better.  U2U's free &lt;a href=&quot; http://www.u2u.be/Res/Tools/CamlQueryBuilder.aspx &quot;&gt;CAML Query Builder&lt;/a&gt; tool significantly improves the experience of querying SharePoint data.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/Sq2PcGTvHUI/AAAAAAAABqM/YB6rGTZrIpA/s1600-h/CamlQueryBuilder.jpg&quot;&gt;&lt;img style=&quot;WIDTH: 400px; HEIGHT: 268px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5381114842670112066&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/Sq2PcGTvHUI/AAAAAAAABqM/YB6rGTZrIpA/s400/CamlQueryBuilder.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But it makes you wonder if something is wrong when you need a tool to retrieve data from your data store.  Do you typically use tools to assist when you're writing SQL?  Probably not.  But like I said hang in there, sporm make things better.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Unlinq my Caml&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;If you were to write the same query as above using sporm it would look like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#2B91AF;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;IQueryable&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;&amp;gt; employees =         GetEmployees().Where(e =&amp;gt;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e.FirstName ==        &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Lee&amp;quot;&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;&amp;amp; e.LastName.StartsWith(&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;Rich&amp;quot;&lt;/span&gt;)&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;amp;&amp;amp; e.Dob &amp;lt;= &lt;span style=&quot;color:blue&quot;&gt;        new&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;DateTime&lt;/span&gt;(2009, 1, 1));&lt;br             style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;Just a little easier to read than CAML, right?  A couple of things to note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fields are strongly typed.  If you were to rename FirstName the compiler would catch every single instance at design time.&lt;/li&gt;
&lt;li&gt;Operators are standard C# operators.  &amp;&amp;, .StartsWith(), and &lt;= are all familiar and concise and use a standard, known precedence.&lt;/li&gt;
&lt;li&gt;Types are standard C# types.  You never have to explicitly say that &quot;Rich&quot; is a string, it just is.&lt;/li&gt;
&lt;li&gt;Your query is actual C# code.  The lambda (closure) and the fact that it uses &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html&quot;&gt;deferred execution&lt;/a&gt; might throw off a junior developer in some scenarios, but the query is readable and works exactly the same as if you were querying in memory objects or querying a database with LINQ to SQL or the Entity Framework.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nice!  What's beautiful about this is that sporm converts your C# directly into CAML using C# 3.0's &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/expression-trees-why-linq-to-sql-is.html&quot;&gt;expression trees&lt;/a&gt; feature.  What sporm can't convert to CAML it executes in memory transparently to you.  Sporm uses log4net and outputs its CAML queries to the console by default, so it is a good idea to watch the output if you're concerned about performance.&lt;/p&gt;

&lt;p&gt;Now the following isn't relevant to the comparison with CAML, but I would be negligent if I didn't explain how the GetEmployees() function works.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;SP != DB B/C of Content Types&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;First of all GetEmployees looks like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;&amp;gt;         GetEmployees() {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;MySPDataContext&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetCurrent()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetList&amp;lt;&lt;span             style=&quot;color:#2B91AF&quot;&gt;Employees&lt;/span&gt;&amp;gt;()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.OfType&amp;lt;&lt;span             style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;&amp;gt;();&lt;br /&gt;        }&lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;   &lt;/p&gt;

&lt;p&gt;How it works is that the static GetCurrent() method retrieves sporm's context object, which knows how to query a SharePoint site, from either the web context or thread local storage; next the GetList() method tells sporm which list you want to query; and the OfType() method tells sporm which content type within the list you want to query.  This last part is important because sporm supports SharePoint's ability to have multiple content types per list, which other LINQ providers like LINQ to SharePoint do not.  But what are content types and why should you care?&lt;/p&gt;

&lt;p&gt;SharePoint's List/Content Type architecture seems odd at first, but it allows interesting scenarios not available in a traditional database.  For instance you might have a calendar list that contains multiple types of records (list items) in the same list.  Your calendar list might contain some combination of the following three record types: meetings with unique fields like Organizer (a person); iterations with unique fields like DeployedToProduction (a Boolean); and actions with unique fields like RelatedEmployee (a reference to another list).  This architecture allows SharePoint to view all three types of records in a single view: like a per month calendar view.  The data might look like this:&lt;/p&gt;

&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Title&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;Start&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;End&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;ContentType&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;Organizer&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;Deployed To Production&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;Related Employee&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Iteration16&lt;/td&gt;
&lt;td&gt;1/12/09&lt;/td&gt;
&lt;td&gt;1/19/09&lt;/td&gt;
&lt;td&gt;Iteration&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stakeholder Demo&lt;/td&gt;
&lt;td&gt;1/19/09 3 PM&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;Meeting&lt;/td&gt;
&lt;td&gt;Lee Richardson&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tag Trunk&lt;/td&gt;
&lt;td&gt;1/19/09&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;Action&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;Lee Richardson&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;Sporm's unique architecture supports this scenario by allowing you to retrieve iterations like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;MySPDataContext&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetCurrent()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetList&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Calendar&lt;/span&gt;&amp;gt;()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.OfType&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Iteration&lt;/span&gt;&amp;gt;();&lt;br             style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;Or get meetings from the same list like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;MySPDataContext&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetCurrent()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetList&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Calendar&lt;/span&gt;&amp;gt;()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.OfType&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Meeting&lt;/span&gt;&amp;gt;();&lt;br             style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;      &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;While you may only use multiple content types per list occasionally you can feel comfortable knowing that sporm will support you when you need it.  The rest of the time you can arrange your architecture to accommodate your 90% scenario of one content type per list.  I'll discuss the architecture I'm using on my current project in my next post.&lt;/p&gt;

&lt;p&gt;For now I hope this has clarified some of the benefits of using sporm, and I hope that you'll consider using it on your next SharePoint project.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Unit Testing SharePoint - Past, Present, and Sporm</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/unit_testing_sharepoint_-_past.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/unit_testing_sharepoint_-_past.html</guid>
        <pubDate>Wed, 09 Sep 2009 15:44:18 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;As I described in &lt;a href=&quot; http://rapidapplicationdevelopment.blogspot.com/2009/08/sharepoint-wild-west-of-software.html&quot;&gt;SharePoint: The Wild West of Software Development&lt;/a&gt; there is a serious problem when you develop for SharePoint: ensuring quality through unit testing is really, really hard.  And that's where a new open source tool just released today called &lt;a href=&quot; http://sporm.codeplex.com/ &quot;&gt;sporm&lt;/a&gt; (SharePoint Object Relational Mapper) comes in.  While sporm provides many benefits besides simplified unit testing I wanted to focus on this topic first, because sporm's approach, which models the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx&quot;&gt;entity framework&lt;/a&gt; in the way it supports POCO's, is a unique feature not available with other SharePoint tools like LINQ to SharePoint.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/09/unit-testing-sharepoint-past-present.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;I'll start by describing the unit testing problem, then provide a conventional solution with mocking, then finish with the elegance of a sporm based solution.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Simple Unit Testing Turns Ugly&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;I would bet anyone that attempts to develop a tiered solution with SharePoint ends up with entities that look something like this:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height:normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;public&lt;/span&gt;&lt;span             style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;        &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;         {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;SPListItem&lt;/span&gt;         ListItem { &lt;span style=&quot;color:blue&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color:blue&quot;&gt;private&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;&amp;lt;summary&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; The constructor         requires that you pass in a list item        &lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; that is used by         your strongly typed properties&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;&amp;lt;/summary&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; Employee(&lt;span style=&quot;color:#2B91AF&quot;&gt;SPListItem&lt;/span&gt;         listItem) {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &lt;/span&gt;ListItem = listItem;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;        &lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;&amp;lt;summary&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; This provides your         entities strong typing to hide        &lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; the native weak         typing in SharePoint&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;color:gray&quot;&gt;&amp;lt;/summary&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;virtual&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; LastName {&lt;br /&gt;      &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;get&lt;/span&gt; { &lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;         (&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;)ListItem[&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;];         }&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;        &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;set&lt;/span&gt; { ListItem[&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;] = &lt;span style=&quot;color:blue&quot;&gt;value&lt;/span&gt;;         }&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;        }&lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;And if you have some function that you'd like to unit test like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:gray;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:green;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:gray;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;lt;summary&amp;gt;&lt;br /&gt;        ///&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:green;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; Typically returns &amp;quot;[LastName], [FirstName]&amp;quot; but skips        &lt;br /&gt;        &lt;/span&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:gray;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:green;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; the comma if either is missing&lt;br /&gt;        &lt;/span&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;o-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:gray;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:green;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;/span&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:gray;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&amp;lt;/summary&amp;gt;&lt;br /&gt;        &lt;/span&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; GetNameFormatted() {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;bool&lt;/span&gt;         noFirst = &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(FirstName);&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;bool&lt;/span&gt;         noLast = &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(LastName);&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;if&lt;/span&gt;         (noFirst &amp;amp;&amp;amp; noLast) &lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;        &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;if&lt;/span&gt;         (noFirst) &lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt; LastName;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;if&lt;/span&gt;         (noLast) &lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt; FirstName;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;.Format(&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;{0},         {1}&amp;quot;&lt;/span&gt;, LastName, FirstName);&lt;br /&gt;        }&lt;br /&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;Now you face a major problem: LastName is tightly coupled with SPListItem.  And SPListItem only contains internal constructors making it unmockable.  So if you keep the tight coupling and pass an SPListItem into the constructor then you need a connection to SharePoint and an employee list (table) and you need to create an employee list item (record), then you test it, and finally you ought to clean up after yourself and delete the list item.  Talk about a simple unit test turned fragile integration test.  Yuck.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Mocking the Solution&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;So at this point you're undoubtedly thinking it's time to mock.  To do this you'll have to make a public constructor that takes no arguments and mark your properties virtual.  Then you can write a test like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;[&lt;span style=&quot;color:#2B91AF&quot;&gt;TestMethod&lt;/span&gt;]&lt;br /&gt;        &lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;void&lt;/span&gt;         TestGetNameFormatted_FirstAndLastExist_LastCommaFirst() {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;        MockRepository&lt;/span&gt; mocks = &lt;span style=&quot;color:blue&quot;&gt;new&lt;/span&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;MockRepository&lt;/span&gt;();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;         mockEmployee = mocks.StrictMock&amp;lt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;&amp;gt;();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Expect&lt;/span&gt;.Call(mockEmployee.FirstName).Return(&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;Lee&amp;quot;&lt;/span&gt;).Repeat.Any();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Expect&lt;/span&gt;.Call(mockEmployee.LastName).Return(&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;Richardson&amp;quot;&lt;/span&gt;).Repeat.Any();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mocks.ReplayAll();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;         actual = mockEmployee.GetNameFormatted();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mocks.VerifyAll();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Assert&lt;/span&gt;.AreEqual(&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;Richardson, Lee&amp;quot;&lt;/span&gt;, actual);&lt;br /&gt;        }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;And then if you're like me you absolutely hate your unit tests.  Because let alone that you had to modify your production code to accommodate unit testing, more importantly your unit tests are now unreadable.  All of them.  Even in simple methods without dependencies your unit tests contain almost as much plumbing code as actual test code.  Enter sporm.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Unmocking with Sporm&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Sporm is an open source tool released on codeplex that was developed by fellow &lt;a href=&quot;http://www.nearinfinity.com/&quot;&gt;Near Infinity&lt;/a&gt; employee &lt;a href=&quot; http://www.nearinfinity.com/blogs/joe_ferner/ &quot;&gt;Joe Ferner&lt;/a&gt; (who, incidentally, is one of the most brilliant developers I know).  While this is a version 1.0 product Joe has been using it on his project and independently I've been using it on my project for several months now, so it is relatively mature.&lt;/p&gt;

&lt;p&gt;So how it works is that at design time sporm will read from your SharePoint site and generate partial classes for each of your list items and each of your content types.  The generated classes don't inherit from anything, giving you the ability architect your solution how you see fit.  And the properties are auto-properties, making the classes just pure POCO.  Here's an example if you're interested:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;[&lt;span style=&quot;color:#2B91AF&quot;&gt;SPOrmContentType&lt;/span&gt;(Name=&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;Employee&amp;quot;&lt;/span&gt;)]&lt;br /&gt;        &lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;partial&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;         : &lt;span style=&quot;color:#2B91AF&quot;&gt;ISPOrmContentType&lt;/span&gt; {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;FieldTitles&lt;/span&gt; {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;         FirstName = &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;First Name&amp;quot;&lt;/span&gt;;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;        &lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;FieldStaticName&lt;/span&gt; {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;         FirstName = &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;;&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;        &lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style=&quot;color:#2B91AF&quot;&gt;SPOrmIdField&lt;/span&gt;()]&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;int&lt;/span&gt; Id {        &lt;span style=&quot;color:blue&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color:blue&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style=&quot;color:#2B91AF&quot;&gt;SPOrmField&lt;/span&gt;(Title         = &lt;span style=&quot;color:#2B91AF&quot;&gt;FieldTitles&lt;/span&gt;.FirstName, StaticName =        &lt;span style=&quot;color:#2B91AF&quot;&gt;FieldStaticName&lt;/span&gt;.FirstName)]&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;      &lt;span style=&quot;color:blue&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;         FirstName { &lt;span style=&quot;color:blue&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color:blue&quot;&gt;set&lt;/span&gt;;         }&lt;br /&gt;        }&lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![if !supportLineBreakNewLine]&gt;        &lt;br style=&quot;mso-special-character:line-break&quot; /&gt;        &lt;![endif]&gt;&lt;/span&gt;    &lt;/p&gt;

&lt;p&gt;Since generated entities look like that, your entities can now look like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;span style=&quot;color:blue&quot;&gt;partial&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;         {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;        &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; GetNameFormatted() {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;bool&lt;/span&gt;         noFirst = &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(FirstName);&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;bool&lt;/span&gt;         noLast = &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(LastName);&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;...&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;        }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Now if that isn't a picture of beauty to you then you haven't been working with SharePoint.  But wait, I hear you asking, how does this have anything to do with SharePoint?  How would an instance of an employee be able to retrieve the data in a SharePoint ListItem?  The answer is in the DataContext.  In your production code you write something like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt;         Employee FindById(&lt;span style=&quot;color:blue&quot;&gt;int&lt;/span&gt; id) {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;        &lt;span style=&quot;color:#2B91AF&quot;&gt;MySPDataContext&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetCurrent()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.GetList&amp;lt;TList&amp;gt;()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.OfType&amp;lt;TContentType&amp;gt;()&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.FirstOrDefault(c =&amp;gt; c.Id ==         id);&lt;br /&gt;        }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;While it might not look so pretty at first you can hide these details in a base type and the nice thing is that it does handle SharePoint's ability to have multiple content types per list (which LINQ to SharePoint does not do, incidentally).  But for now all you need to know is that when you return an Employee thorugh MySPDataContext it subtypes your Employee class and returns you a proxy at runtime.  The proxy overrides each property to return you the appropriate value in the SPListItem.  And if you instantiate an Employee directly (as you would in unit testing) then you can use it like a pure POCO.  If you're familiar with the entity framework this should sound extremely similar.  The result is that you can write your unit tests like this:&lt;/p&gt;

&lt;p&gt;        &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;[&lt;span style=&quot;color:#2B91AF&quot;&gt;TestMethod&lt;/span&gt;]&lt;br /&gt;        &lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;void&lt;/span&gt;         TestGetNameFormatted_FirstAndLastExist_CommaSeparate() {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;         employee = &lt;span style=&quot;color:blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;        Employee&lt;/span&gt; {&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FirstName =        &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Lee&amp;quot;&lt;/span&gt;,        &lt;br /&gt;        &lt;span style=&quot;mso-tab-count:2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LastName =        &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Richardson&amp;quot;&lt;br /&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt;         actual = employee.GetNameFormatted();&lt;br /&gt;        &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;Assert&lt;/span&gt;.AreEqual(&lt;span             style=&quot;color:#A31515&quot;&gt;&amp;quot;Richardson, Lee&amp;quot;&lt;/span&gt;, actual);&lt;br /&gt;        }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;No SharePoint dependencies.  No mocking.  Nothing but pure, unadulterated unit test.  Now that a thing of beauty.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>SharePoint: The Wild West of Software Development</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/sharepoint_the_wild_west_of_so.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/sharepoint_the_wild_west_of_so.html</guid>
        <pubDate>Mon, 17 Aug 2009 21:27:42 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Some argue that Microsoft developers lack rigor -- that techniques like unit testing and continuous integration are virtually unheard of in this space. That's rubbish. I would be shocked if the percentage of developers that track code coverage is significantly different for the .Net or Java spaces (not quite mainstream, but respectable). Mind you I'm talking .Net development in general. SharePoint, now that's another story.&lt;p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/08/sharepoint-wild-west-of-software.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;The shadowy world of SharePoint is one in which source control is a distant memory, where no distinction is drawn between development, test and production environments, and where roaming bandits take over small towns with no fear of the law.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/Son--92lb_I/AAAAAAAABps/a2B3pE9iuW4/s1600-h/WildWest.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 264px;&quot; src=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/Son--92lb_I/AAAAAAAABps/a2B3pE9iuW4/s400/WildWest.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5371104388324880370&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why is this?  How has it come to be?  The answer is that for the most part SharePoint treats code and data as one in the same.  End users can modify data stores: they can add, delete and modify tables (Lists) and columns (Fields) at will.  They can open up SharePoint Designer and modify pages, customize workflows, rob banks, and run local Sherriff's out of town.&lt;/p&gt;

&lt;p&gt;And that's why end users &lt;i&gt;love&lt;/i&gt; SharePoint.  It removes the slow, burdensome bureaucracy involved in doling out development resources from large centrally planned corporate or government IT departments and places that power directly in the hands of end users, allowing them to get their jobs done faster and to adapt to change quicker.  And that is why I maintain that as software developers SharePoint, or a product like it, is in our future -- like it or not.&lt;/p&gt;

&lt;p&gt;But the power given to end users makes rigor and good design extremely hard for developers because the production machine you deployed to last month may look completely different now that you're ready to redeploy.  And Microsoft makes good design even harder with an inflexible API.  Critical classes like SPSite (think SqlConnection) contain no public constructor, rendering them completely unmockable (unless you're willing to spend $450 &lt;i&gt;per developer&lt;/i&gt; for some &lt;a href=&quot;http://www.typemock.com/Buy.php&quot;&gt;TypeMock Isolator&lt;/a&gt; magic).  And vital classes like SPList (think DataSet) are marked final, crippling your ability to make nice strongly typed entities in your architectures.&lt;/p&gt;

&lt;p&gt;So what is a Type-A, quality minded software developer to do?&lt;/p&gt;

&lt;p&gt;The thing to keep in mind is that the challenges that SharePoint places on developers and architects simultaneously make good coding practices harder (but not impossible) while making them more important than ever.&lt;/p&gt;

&lt;p&gt;Because that column you thoughtfully added as required may get reset to optional by an end user in production, you need to write more good tests that validate once solid assumptions.  Because you can't inherit SPList, you'll need to encapsulate it, requiring more code per entity.  Because you can't mock essential SharePoint classes you will need to write more integration tests instead of unit tests.  Because you're writing integration tests your tests will be more fragile and you'll spend more time fixing the test code than the real code.&lt;/p&gt;

&lt;p&gt;And because you're spending more time focusing on quality while your Wild West, short term focused competition in the SharePoint world slings code together, they will appear faster and better able to get applications out the door.  It can be frustrating, because over time your well designed and well tested application will be more maintainable and will cost IT departments less.  But end users frequently don't understand this, so as long term minded SharePoint developers we must focus on educating end users.&lt;/p&gt;

&lt;p&gt;Combat the short term focused mindset by keeping everything in .wsp files, storing code in source control, avoiding the temptation to apply fixes in production, using continuous integration (yes, for SharePoint!), and most importantly tracking code coverage (yes, code coverage for SharePoint code!).  Put quality metrics in status reports for management to see.  Track defects and make your stats publicly available (since you'll have significantly fewer over time than code slingers, and you want end users asking for stats).  In short remind the world that quality counts, even in the shadowy realms of SharePoint.  If we work together we can bring law and order to the ... um, West.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>You cannot grant a user a permission level that is not attached to a web</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/you_cannot_grant_a_user_a_perm.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/you_cannot_grant_a_user_a_perm.html</guid>
        <pubDate>Tue, 04 Aug 2009 17:09:31 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;If you receive this error message that looks like this:&lt;p&gt;
&lt;p&gt;
Microsoft.SharePoint.SPException: You cannot grant a user a permission level that is not attached to a web.&lt;br/&gt;
&amp;nbsp;&amp;nbsp;at Microsoft.SharePoint.SPRoleDefinitionBindingCollection.AddInternal(SPRoleDefinition roleDefinition)&lt;br/&gt;
&amp;nbsp;&amp;nbsp;at Microsoft.SharePoint.SPRoleDefinitionBindingCollection.Add(SPRoleDefinition roleDefinition)&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;When you're doing something like this:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height:normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;private&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;  &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;  SPRoleDefinition&lt;/span&gt; FindAddEditListItemsRoleDefinition(&lt;span    style=&quot;color:#2B91AF&quot;&gt;SPWeb&lt;/span&gt; site) {&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:#2B91AF&quot;&gt;SPRoleDefinition&lt;/span&gt; definition =   site.RoleDefinitions&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;.Cast&amp;lt;&lt;span    style=&quot;color:#2B91AF&quot;&gt;SPRoleDefinition&lt;/span&gt;&amp;gt;()&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;.FirstOrDefault(def   =&amp;gt; def.Name == ROLE_DEFINITION_TITLE);&lt;br /&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;if&lt;/span&gt; (definition != &lt;span style=&quot;color:blue&quot;&gt;null&lt;/span&gt;)  &lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt; definition;&lt;br /&gt;  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;definition =  &lt;span style=&quot;color:blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;SPRoleDefinition&lt;/span&gt;   {&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;Name =   ROLE_DEFINITION_TITLE,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;Description =  &lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Can view and edit list items only.&amp;quot;&lt;/span&gt;,&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;BasePermissions =  &lt;span style=&quot;color:#2B91AF&quot;&gt;SPBasePermissions&lt;/span&gt;.EditListItems&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;|  &lt;span style=&quot;color:#2B91AF&quot;&gt;SPBasePermissions&lt;/span&gt;.ViewListItems&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;|  &lt;span style=&quot;color:#2B91AF&quot;&gt;SPBasePermissions&lt;/span&gt;.ViewFormPages&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;|  &lt;span style=&quot;color:#2B91AF&quot;&gt;SPBasePermissions&lt;/span&gt;.ViewPages&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;| &lt;span style=&quot;color:#2B91AF&quot;&gt; SPBasePermissions&lt;/span&gt;.Open&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;};&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;site.RoleDefinitions.BreakInheritance(&lt;span   style=&quot;color:blue&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;);&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;site.RoleDefinitions.Add(definition);&lt;br /&gt; &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;site.Update();&lt;br /&gt; &lt;span style=&quot;color:green&quot;&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt; definition;&lt;br /&gt; }&lt;/span&gt;

&lt;p&gt;It may be because SharePoint doesn't allow you to use the SPRoleDefinition you just created and you have to return the one you just added.  Stupid, but hopefully it will help someone somewhere.&lt;/p&gt;

&lt;p&gt;  &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;site.Update();&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt;// you can&amp;#39;t   just return definition because SharePoint gives you  &lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt;//&lt;span    style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;quot;You cannot grant a user a permission   level that is not&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;attached to a web&amp;quot; when you attempt to use it, so  &lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;you need to return it again&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;   site.RoleDefinitions&lt;br /&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:green&quot;&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;.Cast&amp;lt;&lt;span    style=&quot;color:#2B91AF&quot;&gt;SPRoleDefinition&lt;/span&gt;&amp;gt;()&lt;br /&gt;  &lt;span style=&quot;color:green&quot;&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;.First(def =&amp;gt; def.Name ==   ROLE_DEFINITION_TITLE);&lt;br /&gt;  }&lt;/span&gt;&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>IEnumerable.Count() is a Code Smell</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/ienumerablecount_is_a_code_sme.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/ienumerablecount_is_a_code_sme.html</guid>
        <pubDate>Thu, 23 Jul 2009 17:31:20 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Way too often I come across code like this:&lt;/p&gt;

 &lt;p class=&quot;MsoNormal&quot;&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes&quot;&gt;IEnumerable&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;&amp;lt;&lt;span    style=&quot;color:#2B91AF&quot;&gt;Product&lt;/span&gt;&amp;gt; products = GetProducts();&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;if&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   (products.Count() == 0) {&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomePlaceHolder.Visible =  &lt;span style=&quot;color:blue&quot;&gt;false&lt;/span&gt;;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  } &lt;span style=&quot;color:blue&quot;&gt;else&lt;/span&gt; {&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomePlaceHolder.Visible =  &lt;span style=&quot;color:blue&quot;&gt;true&lt;/span&gt;;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomeRepeater.DataSource = products;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomeRepeater.DataBind();&lt;o:p&gt;&lt;br /&gt;  }&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt; &lt;/p&gt;

&lt;p&gt;What's wrong with this is that Count() is a LINQ extension method that literally iterates through every item in an enumerable.  In other words it won't short circuit after it finds more than zero items -- it will continue iterating through every single item.  And while that may be a fast operation in dev, it may be a really slow operation in production.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/07/ienumerablecount-is-code-smell.html';
 
        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
 
        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);
 
        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
 
        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;But it gets worse.  Because of LINQ's &lt;a href=&quot; http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html&quot;&gt;deferred execution&lt;/a&gt; the results of .Count() are not cached.  So when there is at least one product you are guaranteed to enumerate every single product twice: once for .Count() and once for .DataSource = products. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Do Any() Solutions Exist?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;One possibility is to instead use IEnumerable.Any().  So you could rewrite the above code like this:&lt;/p&gt;

 &lt;p class=&quot;MsoNormal&quot;&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes&quot;&gt;IEnumerable&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;&amp;lt;Product&amp;gt;   products = GetProducts();&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;bool&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   anyProducts = products.Any();&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;SomePlaceHolder.Visible =   anyProducts;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;if&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   (anyProducts) {&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomeRepeater.DataSource = products;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomeRepeater.DataBind;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;}&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The results will be better regardless of if your data source is in memory or a database, but for illustration purposes LINQ to SQL outputs the following SQL if you run the code smell version when there is at least one product in the database:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;SELECT&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;  &lt;span style=&quot;color:fuchsia&quot;&gt;COUNT&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;(*)&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt; [value]&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;FROM&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   [dbo]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[Product] &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt;   [t0]&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;SELECT&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   [t0]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[ProductId]&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;   [t0]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[ProductName]&lt;span style=&quot;color:gray&quot;&gt;,&lt;o:p&gt;   ...&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;&lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;FROM&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   [dbo]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[Product] &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt;   [t0]&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;And it outputs this SQL if you run the better version when there is at least one product:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;SELECT&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt; &lt;o:p&gt;  &lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;CASE&lt;/span&gt; &lt;o:p&gt;  &lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;EXISTS(&lt;br /&gt;  &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color:gray&quot;&gt;NULL&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt; [EMPTY]&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;FROM&lt;/span&gt; [dbo]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[Product]  &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt; [t0]&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;THEN&lt;/span&gt; 1&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;ELSE&lt;/span&gt; 0&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color:gray&quot;&gt;)&lt;/span&gt;  &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt; [value]&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;SELECT&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   [t0]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[ProductId]&lt;span style=&quot;color:gray&quot;&gt;,&lt;/span&gt;   [t0]&lt;span style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[ProductName]&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt; [dbo]&lt;span    style=&quot;color:gray&quot;&gt;.&lt;/span&gt;[Product] &lt;span style=&quot;color:blue&quot;&gt;AS&lt;/span&gt;   [t0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Looks a little uglier, but if you run the execution plan you've converted two table scans into an index scan and a table scan (well, depending on your schema of course).  Regardless, much better execution-wise.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Undeferring deferred execution&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Now what if your data source is a database and you really want to optimize the heck out of this and only perform one SQL statement?  You could disable deferred execution by doing this:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes&quot;&gt;IList&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;&amp;lt;Product&amp;gt;   products = GetProducts()&lt;b&gt;.ToList();&lt;/b&gt;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;bool&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   anyProducts = products.Any();&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;SomePlaceHolder.Visible =   anyProducts;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes&quot;&gt;if&lt;/span&gt;&lt;span    style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;   (anyProducts) {&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;/span&gt;  &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes&quot;&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomeRepeater.DataSource = products;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  &lt;span style=&quot;mso-tab-count:1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SomeRepeater.DataBind;&lt;o:p&gt;&lt;br /&gt;  &lt;/o:p&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The .ToList() function forces enumeration to happen immediately and cache the results in a list.  This achieves the result of converting two queries into one, but be warned it also destroys one of the nicest benefits of LINQ's deferred execution: the ability to append .Sort() or .Skip().Take() (paging) statements at the very end and have them execute in your original query, in SQL, in the database, where they belong.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;IEnumerable.Count() seems like a pleasant and friendly convenience function; it feels so similar to the innocuous List.Count -- but don't be fooled.  It's a mistake.  One you (or the person who maintains the system when you leave) may soon regret.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Secrets of SharePoint 2010 Exposed at TechEd 2009</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/secrets_of_sharepoint_2010_exp.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/secrets_of_sharepoint_2010_exp.html</guid>
        <pubDate>Sun, 17 May 2009 22:42:01 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description> &lt;p&gt;In case you aren't aware, the details of SharePoint 2010 are under tight wraps.  If you asked any of the presenters at Tech Ed the typical response was &quot;No idea what you're talking about.&quot;  But that doesn't mean presenters didn't occasionally slip up or say more than they probably should have.&lt;/p&gt;
&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/05/secrets-of-sharepoint-2010-exposed-at.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Publically Stated SharePoint 2010 Info&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Here's what has been publically stated about SharePoint 2010 thus far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Requires at least Windows Server 2008 64 bit&lt;/li&gt;
&lt;li&gt;Requires SQL  Server 64 bit (2005 or 2008)&lt;/li&gt;
&lt;li&gt;Will not support for IE 6&lt;/li&gt;
&lt;li&gt;Public testing to occur first half of next year&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This was announced at TechEd by &lt;a href=&quot; http://blogs.msdn.com/thomriz/default.aspx&quot;&gt;Tom Rizzo&lt;/a&gt;, director of Microsoft SharePoint Server,  as posted in this &lt;a href=&quot; http://www.infoworld.com/d/applications/sharepoint-2010-will-require-64-bit-sql-server-141&quot;&gt;InfoWorld&lt;/a&gt; article and also on the &lt;a href=&quot; http://blogs.msdn.com/sharepoint/archive/2009/05/07/announcing-sharepoint-server-2010-preliminary-system-requirements.aspx&quot;&gt;SharePoint blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New SharePoint 2010 Secrets&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;An exciting slip up that has received no press thus far was from the presentation: &lt;a href=&quot; http://www.msteched.com/online/view.aspx?tid=5150ae0f-d6c6-4238-9637-93c7b7ca4054&quot;&gt;Microsoft Visual Studio 2010 Overview for the Business Application Developer&lt;/a&gt;.  If you check 1:00:33 of the presentation you'll see the first glimpse of a SharePoint 2010 Site Home Page:&lt;/p&gt;

&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/ShDErv76MKI/AAAAAAAABpc/xri8sCxYnQY/s1600-h/SP2010-Home-Page.jpg&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 250px;&quot; src=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/ShDErv76MKI/AAAAAAAABpc/xri8sCxYnQY/s400/SP2010-Home-Page.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5336981814315200674&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I could tell something wasn't right when I saw this part of the demo, but fellow &lt;a href=&quot; http://www.nearinfinity.com/&quot;&gt;Near Infinity&lt;/a&gt; employee &lt;a href=&quot;http://www.nearinfinity.com/blogs/joe_ferner/&quot;&gt;Joe Ferner&lt;/a&gt; put it together first when he saw the big red &quot;Give Feedback&quot; button in the top right.  He &lt;a href=&quot; http://twitter.com/joeferner&quot;&gt;tweeted&lt;/a&gt; about what came next: &lt;/p&gt;

&lt;p&gt;&lt;b&gt;&quot;Sharepoint 2010 to have inline list ajaxy editing.&quot;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It looks really nice, and is very exciting since SharePoint is currently a little unwieldy.  Check out this screenshot from 1:01:08:&lt;/p&gt;

&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/ShDEwEHvUOI/AAAAAAAABpk/f4XI7p4EHKU/s1600-h/SP2010-Ajax-Support.jpg&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 250px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/ShDEwEHvUOI/AAAAAAAABpk/f4XI7p4EHKU/s400/SP2010-Ajax-Support.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5336981888453005538&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So that was the most exciting slip up.  Other exciting tidbits were:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;SharePoint designer will support saving workflows to re-use for provisioning&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I learned this one during the Q&amp;A session of the &quot;Automate Business Processes Using InfoPath Forms with Integrated SharePoint Designer Workflows... All without Coding!&quot; talk.  It's currently a pain point that workflows developed in SharePoint designer can't be reused in the same way workflows developed in Visual Studio can, so this will be a wonderful new feature.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;BDC will probably support updating and inserting data&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Apparently MOSS only shipped without this feature because it hadn't been thoroughly tested.  That there has been plenty of time to test this feature by now, so it's a pretty reasonable assumption that it will be in the next version.&lt;/p&gt;
&lt;p&gt;Finally this is pure speculation, but I'm guessing:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;SharePoint 2010 to support ASP.Net Data Services API&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Microsoft supports two AJAX approaches: client side and server side.  The server side uses the UpdatePanel control where you code as usual and everything magically gets AJAXized.  The client side version is part of the unreleased ASP.Net 4.0, but ties in tightly with JSON provided by the .Net Data Services API that was released in the .Net Framework 3.5 SP1.  &lt;/p&gt;
&lt;p&gt;The SharePoint team could have used the server side approach, but why not use the latest technology available, speed up UI significantly, and simultaneously allow web part developers a fantastic level of client side AJAX support?  If they made the entire SharePoint API available via the .Net Data Services API it would enable some powerful fast AJAX web parts.  It would be awesome.&lt;/p&gt;
&lt;p&gt;Finally, the only other tidbit isn't a secret at all, but what I consider to the most exciting feature of  Visual Studio 2010: it will support editing SharePoint solutions without editing XML.  I hate XML, so that will be wonderful.  So are you ready for SharePoint 2010 today?  I sure am.  Pity about the wait.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Code Access Security Cheat Sheet</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/code_access_security_cheat_she.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/code_access_security_cheat_she.html</guid>
        <pubDate>Thu, 07 May 2009 09:36:58 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I did short presentation on &lt;a href=&quot;http://en.wikipedia.org/wiki/Code_Access_Security&quot;&gt;Code Access Security (CAS)&lt;/a&gt; a while ago and put together a cheat sheet to help remember the terms and how they fit together.  It includes screenshots of the .NET Framework 2.0 Configuration tool (in Control Panel\Administrative Tools) and uses &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/06/entity-relationship-diagram-example.html&quot;&gt;Entity Relationship Diagram (ERD) Notation&lt;/a&gt;.  I had to pull it up recently and figured others might also find it helplful.&lt;/p&gt;

&lt;div style='float:right; margin-left:10px;'&gt;
&lt;script type='text/javascript'&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2009/05/code-access-security-cheat-sheet.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;It describes the following terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Permission&lt;/li&gt;
&lt;li&gt;PermissionSet&lt;/li&gt;
&lt;li&gt;Code Group&lt;/li&gt;
&lt;li&gt;Policy Level&lt;/li&gt;
&lt;li&gt;Assembly Instance&lt;/li&gt;
&lt;li&gt;Evidence; and&lt;/li&gt;
&lt;li&gt;Evidence Type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It should print to 8.5 x 11.  Click to enlarge:&lt;/p&gt;

&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SgLivNex9qI/AAAAAAAABpU/gnOSJYssXeE/s1600-h/CAS_Cheat_Sheet.gif&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 291px; height: 400px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SgLivNex9qI/AAAAAAAABpU/gnOSJYssXeE/s400/CAS_Cheat_Sheet.gif&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5333074209460582050&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you find it useful.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Making SharePoint Title a Calculated Column</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/making_sharepoint_title_a_calc.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/making_sharepoint_title_a_calc.html</guid>
        <pubDate>Mon, 27 Apr 2009 08:55:54 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;All SharePoint lists start with a user editable &quot;Title&quot; column that ECB menu's hang off of and that is the default field to display in associated child tables.  This works well most of the time.  For example if you have a list like Company, you can change the display name of Title to &quot;Company Name,&quot; and then Employee records display that field for their parent relationship.&lt;/p&gt;

&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SfUP1O5aPEI/AAAAAAAABpM/GjPbprracyE/s1600-h/employee-sharepoint-list.jpg&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;width: 400px; height: 291px;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SfUP1O5aPEI/AAAAAAAABpM/GjPbprracyE/s400/employee-sharepoint-list.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5329183141269224514&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where this doesn't work well is lists like Employee, where there is no single column that uniquely identifies a row to an end user.  You could create a new &quot;Full Name&quot; calculated column and delete the Title column, but making Title a calculated column just feels like a cleaner solution.&lt;/p&gt;

&lt;p&gt;I looked into making Title calculated where it is defined in CAML, but it looked pretty messy, and a true calculated column additionally suffers from the limitation that you can't pull from other lists.  The solution I settled on was to populate it in ItemAdding and ItemUpdating.  Of course you tie into those methods with something like:&lt;/p&gt;

    &lt;p&gt;
        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:#2B91AF;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;
mso-no-proof:yes&quot;&gt;SPList&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt; employeeList 
        = site.Lists[&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Employee List&amp;quot;&lt;/span&gt;];&lt;br /&gt;
        employeeList.EventReceivers.Add(&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;
        SPEventReceiverType&lt;/span&gt;.ItemUpdating,
        &lt;br /&gt;
        &lt;span style=&quot;color:#A31515&quot;&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;quot;[four 
        part assembly name]&amp;quot;&lt;/span&gt;,
        &lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;
        &amp;quot;Namespace.EmployeeEventReceiver&amp;quot;&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;);&lt;br /&gt;
        employeeList.EventReceivers.Add(&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#2B91AF&quot;&gt;
        SPEventReceiverType&lt;/span&gt;.ItemAdding,
        &lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;[four 
        part assembly name]&amp;quot;&lt;/span&gt;,
        &lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#A31515&quot;&gt;
        &amp;quot;Namespace.EmployeeEventReceiver&amp;quot;&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The only reason this is worth documenting is because setting title is a little messy in the event receivers and there is very little documentation on how to do it.&lt;/p&gt;

    &lt;p&gt;
        &lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;color:blue;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;
mso-no-proof:yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-no-proof:yes&quot;&gt;
        &lt;span style=&quot;color:blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color:#2B91AF&quot;&gt;
        EmployeeEventReceiver&lt;/span&gt; : &lt;span style=&quot;color:#2B91AF&quot;&gt;SPItemEventReceiver&lt;/span&gt; 
        {&lt;br /&gt;
        &lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;
        &lt;span style=&quot;color:blue&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;void&lt;/span&gt; 
        ItemAdding(&lt;span style=&quot;color:#2B91AF&quot;&gt;SPItemEventProperties&lt;/span&gt; properties) 
        {&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        fullName = GetFullName(properties);&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;properties.AfterProperties[&lt;span 
            style=&quot;color:#A31515&quot;&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;] = fullName;&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;base&lt;/span&gt;.ItemAdding(properties);&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
        &lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;private&lt;/span&gt;
        &lt;span style=&quot;color:blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        GetFullName(&lt;span style=&quot;color:#2B91AF&quot;&gt;SPItemEventProperties&lt;/span&gt; properties) 
        {&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        firstName = properties.AfterProperties[&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;First_Name&amp;quot;&lt;/span&gt;].ToString();&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        middleName = properties.AfterProperties[&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Middle_Name&amp;quot;&lt;/span&gt;].ToString();&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        lastName = properties.AfterProperties[&lt;span style=&quot;color:#A31515&quot;&gt;&amp;quot;Last_Name&amp;quot;&lt;/span&gt;].ToString();&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;return&lt;/span&gt;
        &lt;span style=&quot;color:#2B91AF&quot;&gt;Employee&lt;/span&gt;.GetFullName(firstName, middleName, 
        lastName);&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
        &lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;public&lt;/span&gt;
        &lt;span style=&quot;color:blue&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color:blue&quot;&gt;void&lt;/span&gt; 
        ItemUpdating(&lt;span style=&quot;color:#2B91AF&quot;&gt;SPItemEventProperties&lt;/span&gt; 
        properties) {&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        fullName = GetFullName(properties);&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;string&lt;/span&gt; 
        internalTitleName = properties.ListItem&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Fields[&lt;span 
            style=&quot;color:#A31515&quot;&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;].InternalName;&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
        properties.AfterProperties[internalTitleName] = fullName;&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:blue&quot;&gt;base&lt;/span&gt;.ItemUpdating(properties);&lt;br /&gt;
        &lt;span style=&quot;mso-spacerun:yes&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;
        }&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The tricky part is getting the title field by internal name in ItemUpdating vs. getting it normally in ItemAdding.  It's pretty easy once you work through it, but it took me longer than it should have.  So hopefully this helps someone somewhere. &lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>An Exciting Future: C# 4.0, Silverlight 3, MVC Dynamic Data, Live Mesh, VS 2010, ...</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/an_exciting_future_c_4.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/an_exciting_future_c_4.html</guid>
        <pubDate>Mon, 08 Dec 2008 10:45:30 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Last week I attended the &lt;a href=&quot;http://blogs.msdn.com/devkeydet/archive/2008/12/05/follow-up-reston-developer-conference-04dec08.aspx&quot;&gt;Public Sector Developer Conference in Reston, Virginia&lt;/a&gt;. 
    Summary: I can barely contain my excitement for just about everything Microsoft 
    is doing right now for software development. In particular the first talk &quot;&lt;a href=&quot;http://lrvsww.bay.livefilestore.com/y1plQsNGQIdpRNBM9vujeHGiFcpyjsTAY8KSUmzLBLX-Sn23H-zSo_-UY7R7ks8ShJ5QplLlmcB3ug/marcscNETFX4.0VS2010Overview.pptx?download&quot;&gt;What I've learned about Visual Studio 2010, .NET Framework 4.0 (and beyond), Silverlight 3 (and beyond)&lt;/a&gt;&quot; 
    was so exciting I almost gave a standing ovation.&lt;/p&gt;

&lt;div style=&quot;float: right; margin-left: 10px;&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/12/exciting-future-c-40-silverlight-3-mvc.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;What Marc learned about Visual Studio 2010, .NET Framework 4.0, Silverlight 3&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So believe it or not this talk by &lt;a href=&quot;http://devkeydet.com/&quot;&gt;Marc Schweigert&lt;/a&gt; (who is a fabulous presenter 
    by the way) was a 90 minute distillation of &lt;i&gt;everything&lt;/i&gt; that happened at &lt;a href=&quot;http://www.microsoftpdc.com/&quot;&gt;PDC&lt;/a&gt; (which sadly I missed).  Consequently it flew like a jet engine, gave barely a minute or two to every topic, and required either massive amounts of caffeine or a good amount of prerequisite reading.  Fortunately I had both.&lt;/p&gt;
&lt;p&gt;To summarize the presentation I'll just give my favorite upcoming technologies 
    and sort it roughly in decreasing level of my excitement:&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx&quot;&gt;ASP.Net MVC Dynamic Data&lt;/a&gt;
&lt;br /&gt;Overview: Ruby on Rails for .Net
&lt;br /&gt;Impressions: As if ASP.Net MVC wasn't cool enough.  This looks awesome! I want to try it on a real project.&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://en.wikipedia.org/wiki/ADO.NET_Data_Services&quot;&gt;ADO.Net Data Services (Astoria)&lt;/a&gt;
&lt;br /&gt;Overview: Expose LINQ ORM data (e.g. LINQ to Entities) to web services, now 
    with better BLOB support
&lt;br /&gt;Impressions: Powerful, exciting (just a little scary)&lt;/p&gt;
&lt;p&gt;Technology: Astoria Offline
&lt;br /&gt;Overview: Write disconnected apps that sync to ADO.Net Data Services
&lt;br /&gt;Impressions: Frikin' awesome. I can't wait to see/write disconnected apps.&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx&quot;&gt;ASP.Net AJAX - jQuery Support&lt;/a&gt;
&lt;br /&gt;Overview: ASP.Net will abandon its custom &quot;roll your own&quot; JavaScript framework 
    and adopt a leading open source one .&lt;br /&gt;Impressions: Amazing.  I couldn't be happier.&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://channel9.msdn.com/pdc2008/BB30/&quot;&gt;Live Mesh Web Apps&lt;/a&gt;
&lt;br /&gt;Overview: Offline capable, in browser or on desktop apps (HTML/AJAX or Silverlight) that run &quot;in the mesh&quot;
&lt;br /&gt;Impressions: Wow, this is some really cool stuff, I'll definitely be keeping an eye on this technology&lt;/p&gt;
&lt;p&gt;Technology: SharePoint Integration 
&lt;br /&gt;Overview: Build web parts, wsp files, etc directly in VS without an add-on
&lt;br /&gt;Impressions: Fantastic!  Awesome!  This was a major point.&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://en.wikipedia.org/wiki/Task_Parallel_Library#TPL&quot;&gt;Task Parallel Library (TPL)&lt;/a&gt;
&lt;br /&gt;Overview: Simplify parallelization and avoid programming in threads by using delegates
&lt;br /&gt;Impressions: This looks absolutely amazing, I can't wait&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc163329.aspx&quot;&gt;Parallel LINQ&lt;/a&gt;
&lt;br /&gt;Overview: Parallelize LINQ queries
&lt;br /&gt;Impressions: So easy, so powerful, so exiting&lt;/p&gt;
&lt;p&gt;Technology: 
    &lt;a href=&quot;http://geekswithblogs.net/sdorman/archive/2008/11/10/clr-4.0-in-process-side-by-side-clr-hosting.aspx&quot;&gt;In Process Side By Side Model&lt;/a&gt;
&lt;br /&gt;Overview: Run both 2.0 and 4.0 CLR code in the same process
&lt;br /&gt;Impressions: Wow.  Minimize existing app upgrade pain; free developers to use new features in old code bases; free language designers more flexibility in refactoring the C# language.&lt;/p&gt;
&lt;p&gt;Technology: 
    &lt;a href=&quot;http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=csharpfuture&amp;amp;DownloadId=3550&quot;&gt;C# 4.0&lt;/a&gt;
&lt;br /&gt;Overview:  Named optional parameters and dynamic types
&lt;br /&gt;Impressions: Named parameters: cool, dynamic types: controversial, but I suspect a very good thing&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://research.microsoft.com/fsharp/fsharp.aspx&quot;&gt;F#&lt;/a&gt;
&lt;br /&gt;Overview: Functional programming language to ship by default with VS
&lt;br /&gt;Impressions: I'm playing with this now, it's very interesting, but I'm not prepared to comment yet&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://www.codeplex.com/MEF&quot;&gt;Managed Extensibility Framework&lt;/a&gt;
&lt;br /&gt;Overview: Massively simplify creating desktop app add-on frameworks.
&lt;br /&gt;Impressions: This has the potential to change desktop apps to very light containers that load functionality as necessary.  I am hopeful and excited.&lt;/p&gt;
&lt;p&gt;Technology: VS 2010 IDE Improvements
&lt;br /&gt;Overview: WPF &amp;amp; XAML Editor better, Multi-Monitor Support, Built on WPF
&lt;br /&gt;Impressions: Cool, looking forward to trying.  I like the dog-food approach, although as I've pointed out earlier &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/11/id-prefer-to-post-positive-happy-or.html&quot;&gt;dog-food isn't everything&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://blogs.msdn.com/efdesign/&quot;&gt;ADO.Net Entity Framework V2&lt;/a&gt;
&lt;br /&gt;Overview: The DBMS agnostic LINQ based ORM now with N-tier improvement, DDL generation, caching
&lt;br /&gt;Impressions: DDL generation was interesting, but apparently won't support deltas, that's for another product, maybe Oslo.  Caching support looks fabulous.&lt;/p&gt;
&lt;p&gt;Technology: 
    &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Presentation_Foundation&quot;&gt;WPF&lt;/a&gt;
&lt;br /&gt;Overview: WPF to have more controls, better usability in VS, and simplify ribbon programming 
&lt;br /&gt;Impressions: Cool, but .. am I the only person who hates the ribbon?&lt;/p&gt;
&lt;p&gt;Technology: 
    &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2008/11/16/update-on-silverlight-2-and-a-glimpse-of-silverlight-3.aspx&quot;&gt;Silverlight 3&lt;/a&gt;
&lt;br /&gt;Overview: 3D &amp;amp; GPU support; will work as well as WPF in VS; H.264 support
&lt;br /&gt;Impressions: 3D = Very cool; VS WPF = Cool, although I may still program in XAML; and H dot two sixty what?&lt;/p&gt;
&lt;p&gt;Technology: Web Development
    in VS 2010&lt;br /&gt;Overview: JavaScript intellisence improvements; view-state improvement, Deployment simplified (e.g. Web.Production.Config &amp;amp; setup packages); new controls (chart)
&lt;br /&gt;Impressions: Very nice.&lt;/p&gt;
&lt;p&gt;Technology: 
    &lt;a href=&quot;http://weblogs.asp.net/bleroy/archive/2008/07/30/using-client-templates-part-1.aspx&quot;&gt;ASP.Net AJAX - Client Templates&lt;/a&gt;
&lt;br /&gt;Overview: Simplifying AJAX without an UpdatePanel
&lt;br /&gt;Impressions: I'm lazy so I'll probably stick with UpdatePanel &amp;amp; server based approach, but I'm very happy to see the new client based focus as an additional option&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Workflow_Foundation&quot;&gt;Workflow Foundation (WF)&lt;/a&gt;
&lt;br /&gt;Overview: More controls, faster, better debugging
&lt;br /&gt;Impressions: I haven't really had a need for it WF, but the enhancements sound good.&lt;/p&gt;
&lt;p&gt;Technology: &lt;a href=&quot;http://channel9.msdn.com/pdc2008/TL23/&quot;&gt;Oslo&lt;/a&gt;
&lt;br /&gt;Overview: Create DSLs that do things
    like help manage databases&lt;br /&gt;Impressions: I fail to see what problem this solves, but &lt;a href=&quot;http://martinfowler.com/bliki/Oslo.html&quot;&gt;Martin Fowler thinks it's cool&lt;/a&gt;, so I'll keep an eye on it.&lt;/p&gt;
&lt;p&gt;Technology: 
    &lt;a href=&quot;http://msdn.microsoft.com/en-us/sqlserver/dataservices/default.aspx&quot;&gt;SQL Data Services&lt;/a&gt;
&lt;br /&gt;Overview: Basically Amazon &lt;a href=&quot;http://en.wikipedia.org/wiki/Amazon_Simple_Storage_Service&quot;&gt;S3 &lt;/a&gt; (cloud stuff)
&lt;br /&gt;Impressions: In case you didn't know &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/07/referential-integrity-data-modeling.html&quot;&gt; I love referential integrity&lt;/a&gt;, so I'm not a big fan.  What did impress me is Microsoft will merge the LINQ serialization approach with ADO.Net Data Services.  Nice benefit to multiple technologies within one company.&lt;/p&gt;
&lt;b&gt;Summary&lt;/b&gt;

&lt;p&gt;There's so much going on it's a little overwhelming and I'm sure I missed stuff, but you can see why 
    I'm so excited.  I vow to never miss a PDC again.&amp;nbsp; Anyway I hope this post helped 
    clear up the vast amount of exciting new technologies coming out soon.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Applications Can't Use SharePoint Master Pages</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/applications_can_t_use_sharepoint.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/applications_can_t_use_sharepoint.html</guid>
        <pubDate>Wed, 12 Nov 2008 12:08:28 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;This is the story of stupid SharePoint problem and an ugly, kludgy, and embarrasing solution. On our project we have the need for an application that looks and feels like a SharePoint subsite. Specifically, we need it to inherit from SharePoint's masterpage. But we also need it to be a separate IIS application. &lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/11/applications-cant-use-sharepoint-master.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;Problem: SharePoint dislikes Applications&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;We get the following error when we try to dynamically set the MasterPageFile in code:&lt;/p&gt;
&lt;p&gt;System.ArgumentException: The virtual path '/_layouts/application.master' maps to another application, which is not allowed.&lt;/p&gt;
&lt;p&gt;Several sites say we just can't do what we're trying to do. We considered a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx&quot;&gt;Virtual Path Provider&lt;/a&gt;, but decided not to even go down that path because SharePoint's master page undoubtedly has hooks into web.config and httpmodules and such, so we came up with the following hack:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Solution: An Ugly SharePoint Text Manipulation Hack&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Deploy a nearly blank page in to /_layouts/ (we do this in our WebAppManifest.xml &amp;amp; WebAppSolution.ddf files). In PageBase (that all pages inherit from) we override Render to retrieve the blank page and do text manipulation to insert our content into it. Here's the code:&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; Render(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;HtmlTextWriter&lt;/span&gt; writer) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;HttpWebRequest&lt;/span&gt; request = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;HttpWebRequest&lt;/span&gt;)&lt;span style=&quot;COLOR: #2b91af&quot;&gt;WebRequest&lt;/span&gt;.Create(GetUrlToBlankPage());&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;request.Credentials = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;CredentialCache&lt;/span&gt;.DefaultCredentials;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;using&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;WebResponse&lt;/span&gt; webResponse = request.GetResponse()) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;StreamReader&lt;/span&gt; streamReader = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;StreamReader&lt;/span&gt;(webResponse.GetResponseStream());&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; pageHostHtml = streamReader.ReadToEnd();&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;using&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;StringWriter&lt;/span&gt; stringWriter = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;StringWriter&lt;/span&gt;())&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;using&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;HtmlTextWriter&lt;/span&gt; htmlTextWriter = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;HtmlTextWriter&lt;/span&gt;(stringWriter)) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;base&lt;/span&gt;.Render(htmlTextWriter);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; renderPageHtml = stringWriter.ToString();&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; title = GetTitleFromHtml(renderPageHtml);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pageHostHtml.Replace(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;PAGE TITLE&quot;&lt;/span&gt;, title);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; content = GetContentFromHtml(renderPageHtml);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pageHostHtml = RemoveFormData(pageHostHtml);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pageHostHtml = pageHostHtml.Replace(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;DO NOT MODIFY THIS PAGE&quot;&lt;/span&gt;, content);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;writer.Write(pageHostHtml);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; GetContentFromHtml(&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; html) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Match&lt;/span&gt; match = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Regex&lt;/span&gt;.Match(html, &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&amp;lt;body&amp;gt;(.*)&amp;lt;/body&amp;gt;&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegexOptions&lt;/span&gt;.IgnoreCase | &lt;span style=&quot;COLOR: #2b91af&quot;&gt;RegexOptions&lt;/span&gt;.Singleline);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; match.Success ? match.Groups[1].Captures[0].Value : &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; GetTitleFromHtml(&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; html) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Match&lt;/span&gt; match = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Regex&lt;/span&gt;.Match(html, &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&amp;lt;title&amp;gt;(.*)&amp;lt;/title&amp;gt;&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: #2b91af&quot;&gt;RegexOptions&lt;/span&gt;.IgnoreCase);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; match.Success ? match.Groups[1].Captures[0].Value : &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; RemoveFormData(&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; html) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; replaced = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Regex&lt;/span&gt;.Replace(html, &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&amp;lt;form[^&amp;gt;]*&amp;gt;&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&quot;&lt;/span&gt;,, &lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegexOptions&lt;/span&gt;.IgnoreCase | &lt;span style=&quot;COLOR: #2b91af&quot;&gt;RegexOptions&lt;/span&gt;.Singleline);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;replaced = replaced.Replace(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&amp;lt;/form&amp;gt;&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;&quot;&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; replaced;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I'm sure there are plenty of optimizations that we can do (e.g. caching), but that's the basic idea. But this solution makes me feel so dirty. So please, please, dear reader, tell me there is a better way. I want to feel clean again.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Eight Miserable TFS Features</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/eight_miserable_tfs_features.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/eight_miserable_tfs_features.html</guid>
        <pubDate>Thu, 06 Nov 2008 10:39:29 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I'd prefer to post a positive, happy, or ideally emotion-agnostic technical post, but today Microsoft Visual Studio Team Foundation Server (TFS)'s source control pissed me off one too many times. I could go on for pages, but this list represents the top eight reasons why you should never pick Team Foundation Server for source control (in decreasing order of annoyance).&lt;/p&gt;
&lt;div style=&quot;float: right; margin-left: 10px;&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/11/id-prefer-to-post-positive-happy-or.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;1. Can't see changes on get latest&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you like to publically humiliate co-workers when they violate coding standards, or even if you just want to keep an eye on what they're doing, then TFS is absolutely not for you. I'm completely spoiled by Tortoise SVN which allows you to &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Get latest&lt;/li&gt;
&lt;li&gt;See which files have changed; and&lt;/li&gt;
&lt;li&gt;Quickly view the diff&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;I suppose I should be happy TFS at least allows #1.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;2. TFS drops Solution Items&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Solution Items are files and folders that exist outside of projects, but within solutions. For instance my current project has an etc directory that contains database scripts and such. First of all it would be nice if Visual Studio automatically recognized new items in the etc directory. Ironically you have to &quot;add existing item&quot; even though it already exists. Fine, whatever. But more importantly it would be nice if Visual Studio didn't periodically delete files said files from the solution. As convenient of a feature as that may sound, it has caused numerous problems. A &quot;Blame&quot; has determined that nearly every person on the project has activated this feature leading me to believe it is truly a bug. Brilliant.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;3. Checked In Files Are Marked Read-only&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Suppose you have a file you want to open outside of Visual Studio (gasp). With TFS if you don't already have Visual Studio open you have to start the IDE in order to check the file out to remove the read only bit. So ten minutes later you're ready to go. At least TFS does allow multiple check-out.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;4. TFS server name in project file&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;TFS embeds the server name in every single one of your project files. The beauty of this approach becomes evident when one team member uses an IP address, while another uses the domain name or computer name. You end up fighting over the project files and automatically checking them out when all you want to do is view them.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;5. Can't Access Source Control Outside of Visual Studio&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Want to check in or get latest without opening Visual Studio? Yea, you can't. Hope you don't have any java (non-Microsoft) code on your project.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;6. Reconciling, Painfully Slow&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;TFS actually does a decent job of auto merging conflicting files. And when it can't auto-merge conflicting files you can view each file side by side and click which change you want to keep. But the process is painful and slow. For instance if you forget to get latest before check in and there are conflicts you can resolve them, but your check in will always fail. Get latest seems to take much longer when there are conflicts. Auto merge is really slow. If there are un-reconcilable conflicts hitting the &quot;resolve&quot; button takes forever and must be done for each and every conflict. It's like it downloads the entire history of the file. And that wait is mandatory even if you simply want to discard either your or the server's changes.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SRMKdkvWsoI/AAAAAAAABls/5wnOoydO0Bc/s1600-h/Conflict+Resolution.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5265563892521022082&quot; style=&quot;width: 400px; height: 369px;&quot; alt=&quot;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SRMKdkvWsoI/AAAAAAAABls/5wnOoydO0Bc/s400/Conflict+Resolution.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SRMKd1OyoCI/AAAAAAAABl0/HOduUW7bsf0/s1600-h/Merge+Tool.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5265563896947843106&quot; style=&quot;width: 400px; height: 267px;&quot; alt=&quot;&quot; src=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SRMKd1OyoCI/AAAAAAAABl0/HOduUW7bsf0/s400/Merge+Tool.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;7. *.vsmdi files&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This is just a frustrating known bug where if you use TFS for unit testing (Team Foundation Server Test System) and TFS for source control, Visual Studio will either take this .vsmdi file which is essential file for unit testing and either duplicate it or corrupt it. There's a lot of ink spilled on this &lt;a href=&quot;http://kjellsj.blogspot.com/2006/04/vsmdi-file-weak-spot-of-vsts-test.html&quot;&gt;vsmdi bug&lt;/a&gt; and there are some workarounds, but it's a pain.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;8. Moving a folder opens all files in the folder&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This was the last straw and the impetus for writing this post. Today I wanted to move a &quot;solution item&quot; into a project. I opened the Source control Explorer (which is impossible to find in the first place) and right clicked, selected move, entered my destination, and TFS in its wisdom opened every file in the folder nearly bringing my machine to its knees. There are hundreds of small annoyances like this every day with TFS.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;In Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;TFS actually has some nice features that I like over SVN. Like the merge tool is pretty good, and being able to see all people who are currently working on a file is nice. But overall the cons heavily outweigh the pros. And if it's any indication how bad TFS is for source control (or how much developers hate it) Codeplex has even implemented a &lt;a href=&quot;http://stevenharman.net/blog/archive/2008/09/09/subversion-support-on-codeplex.aspx&quot;&gt;SVN to TFS bridge&lt;/a&gt; on their server. &lt;/p&gt;
&lt;p&gt;It's ridiculous to me that Microsoft uses this tool internally and sells it and people buy it! I must be missing something. If so please post comments to this post. Because the entire thing boggles my mind.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Forget Burndown Use Burnup Charts</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/forget_burndown_use_burnup_charts.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/forget_burndown_use_burnup_charts.html</guid>
        <pubDate>Thu, 23 Oct 2008 22:41:25 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Agile projects traditionally use burndown charts to visually show work remaining over time. This could be for the current iteration or it could be for the duration of the project. Either way they can help managers (or the Project Owner in Scrum) track velocity, estimate either the project or iteration completion date, or find trends in past performance. But burndown charts have a major shortcoming: they fail to show what makes agile projects agile: new requirements. And that's where burnup charts come in. But first let's examine burndown charts.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/10/forget-burndown-use-burnup-charts.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');
        redditIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(redditIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;The Problem with Burndown&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A typical burndown for the life of a project might look like this:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SQExigphzWI/AAAAAAAABlE/CxANEtBwb2Q/s1600-h/Burndown.gif&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;WIDTH: 400px; CURSOR: hand; HEIGHT: 271px&quot; alt=&quot;&quot; src=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SQExigphzWI/AAAAAAAABlE/CxANEtBwb2Q/s400/Burndown.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It shows the project started with 100 points of work in the backlog; it's completed eight iterations; the team accomplishes about ten points an iteration; and if everything continues at the current velocity the project will complete all work within another two iterations. Great.&lt;/p&gt;
&lt;p&gt;But what happened in iteration six? Very little appears to have been accomplished. Maybe the team all took a vacation. Maybe there was a major problem or the team incorrectly estimated complexity. Or perhaps a large set of new requirements were added to the backlog because the customer decided what they thought they wanted wasn't what they really needed: namely the exact scenario agile was designed for.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Burnup Charts&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The problem is that burndown charts lack two essential pieces of information. First, how much work was actually accomplished during a given iteration (as opposed to how much work remains to be completed) and second how much total work the project contains (or if you prefer how much scope has increased each iteration). A burnup chart for the exact project above might look like this:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/SQExi1j16lI/AAAAAAAABlM/pqg4SgFBkIs/s1600-h/Burnup.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5260540314308176466&quot; style=&quot;WIDTH: 400px; CURSOR: hand; HEIGHT: 273px&quot; alt=&quot;&quot; src=&quot;http://4.bp.blogspot.com/_gez10dNhuPk/SQExi1j16lI/AAAAAAAABlM/pqg4SgFBkIs/s400/Burnup.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We can now clearly see that the team did not take a breather in iteration six. They continued to complete about ten points per iteration, but during the sixth iteration the scope increased by about twenty points.&lt;/p&gt;
&lt;p&gt;One could imagine the opposite happening as well. Later in the project the team might delete old user stories that were envisioned during project inception and thus decrease the total scope. The burndown chart would incorrectly show such a scenario as a sudden increase in velocity.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Either way the burndown chart hides essential information. I propose we throw it away and show the slightly more complicated, but infinitely more useful burnup chart. After all you wouldn't want upper management thinking you were lazy in iteration six would you?&lt;/p&gt; 
</description>
        
          <category term="agile" label="agile"/>
        
          <category term="development" label="development"/>
        
          <category term="general" label="general"/>
        
      </item>
    
      <item>
        <title>Silverlight: Cannot specify both Name and x:Name attributes</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/silverlight_cannot_specify_both_name.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/silverlight_cannot_specify_both_name.html</guid>
        <pubDate>Mon, 11 Aug 2008 23:58:29 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I received the following error while upgrading from Silverlight beta 1 to beta 2: Cannot specify both Name and x:Name attributes. I'm sure there can be many causes, but since there isn't much written on this, here is one cause. &lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/08/silverlight-cannot-specify-both-name.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');
        redditIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(redditIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;If you have a custom control you can no longer put an x:Name on the root element if you also have an x:Name on an instance of the control. A crappy work-around is to declare the root node in code and set it to the parent of a child element. For instance:&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;Canvas&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; x&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;Class&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;=&quot;MyNamespace.MyCustomControl&quot;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&lt;/span&gt;xmlns&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;=&quot;http://schemas.microsoft.com/client/2007&quot;&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&lt;/span&gt;xmlns&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;s&gt;x&lt;/s&gt;&lt;/span&gt;&lt;s&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;=&quot;LayoutRoot&quot;&lt;/span&gt; &lt;br /&gt;&lt;/s&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt; x&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;=&quot;_stackPanel&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Canvas&lt;/span&gt; LayoutRoot;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt; &lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;&amp;lt;summary&amp;gt;&lt;br /&gt;///&lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt; Constructor&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt; &lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;&amp;lt;/summary&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; ComboBox() {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;InitializeComponent();&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// set _controlBase after InitializeComponent &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// &lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;so _stackPanel is initialized&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LayoutRoot = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Canvas&lt;/span&gt;)_stackPanel.Parent;&lt;br /&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This is pretty fragile, so I'd love to hear any other solutions. &lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>DEFCON Day One</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/defcon_day_one.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/defcon_day_one.html</guid>
        <pubDate>Sat, 09 Aug 2008 10:17:29 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;It would probably be more interesting to blog about my numerous traveling mishaps (summary: never stay at Circus Circus however close it may be to your conference), but I thought a quick bullet point version of the first day at DEFCON 16 would be more relevant. Incidentally this trip was possible because of a generous training budget benefit provided by &lt;a href=&quot;http://www.nearinfinity.com/&quot;&gt;Near Infinity&lt;/a&gt;.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/08/defcon-16-day-one.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');
        redditIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(redditIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;Making the DEFCON 16 Badge&lt;/b&gt;, Joe &quot;Kingpin&quot; Grand&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The default firmware makes the badge function as a &lt;a href=&quot;www.tvbgone.com&quot;&gt;TV-B-Gone&lt;/a&gt; (it really turned on/off my hotel room TV ... cool)&lt;/li&gt;
&lt;li&gt;You should be able to transfer files between SD card readers in badges (haven't tried)&lt;/li&gt;
&lt;li&gt;Later in the day I soldered for my first time ever and added a mini-USB port to the card in the &quot;Hardware Hacking Village&quot; This was a rush, very cool. Thanks to Joe and Andrew for the assistance.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SJ2iCQBubnI/AAAAAAAABDU/dH_F6qY1yNc/s1600-h/Badge+Front.jpg&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://3.bp.blogspot.com/_gez10dNhuPk/SJ2iCQBubnI/AAAAAAAABDU/dH_F6qY1yNc/s400/Badge+Front.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SJ2iIfytESI/AAAAAAAABDc/YeyEYxo9GT8/s1600-h/Badge+Back.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5232516608931205410&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://2.bp.blogspot.com/_gez10dNhuPk/SJ2iIfytESI/AAAAAAAABDc/YeyEYxo9GT8/s400/Badge+Back.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Deciphering Captcha&lt;/b&gt; Michael Brooks&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It never occurred to me you could generate all possible outcomes of a captcha algorithm to break it, cool idea&lt;/li&gt;
&lt;li&gt;Never read a script at a conference, however interesting the topic may be, I left after 5 minutes&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Whitespace: A Different Approach to JavaScript Obfuscation&lt;/b&gt;, Kolisar&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Problem: Your Cross Site Scripting Code needs to evade human and/or automatic detection&lt;/li&gt;
&lt;li&gt;Solution: Embed JavaScript code in whitespace as tabs (1) and spaces (0)&lt;/li&gt;
&lt;li&gt;This was a really cool demo&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;New Tool for SQL Injection and DNS Exfiltration&lt;/b&gt;, Robert Ricks&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQL Injection is still a widespread vulnerability&lt;/li&gt;
&lt;li&gt;Once you get in you can do all kinds of things, their demo included viewing the database schema&lt;/li&gt;
&lt;li&gt;They showed a tool that automatically exploits vulnerabilities really fast, very cool&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Living in the RIA (Rich Internet Application) World&lt;/b&gt;, Alex Stamos, David Thiel &amp;amp; Justine Osborne&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A review of security vulnerabilities in five new RIA technologies: Adobe AIR, MS Silverlight, Google Gears, Mozilla Prism, and HTML 5&lt;/li&gt;
&lt;li&gt;All technologies significantly increased attack surface and had vulnerabilities&lt;/li&gt;
&lt;li&gt;Surprisingly Silverlight seemed to come out on top (go MS) followed by Adobe AIR&lt;/li&gt;
&lt;li&gt;Google Gears, Mozilla Prism, and HTML 5 all have a long way to go&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Bringing Sexy Back: Breaking in with Style&lt;/b&gt;, David Maynor &amp;amp; Robert Graham&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Penetration testing is generally boring work, just run a few tools&lt;/li&gt;
&lt;li&gt;Banks and federal agencies need to do more serious and creative pen-testing&lt;/li&gt;
&lt;li&gt;Scenario: Russian czar hires developers with a 1 million budget and wants to break in to your company&lt;/li&gt;
&lt;li&gt;Approach 1: Put iPhone in box, attach external power supply, turn on, fed ex to target company, while box is in mail room TTY to phone bypass physical security, attack wireless network&lt;/li&gt;
&lt;li&gt;Approach 2: &quot;Spear Phishing&quot;&amp;nbsp;- Start fake company, get domain name, get SSL certificate, send &quot;New 401(k) Provider&quot; e-mail to target company, link to bogus website, sign malicious ActiveX control so there aren't warnings when they download&lt;/li&gt;
&lt;li&gt;Wow, this talk was really cool, really eye opening&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Keeping Secret Secrets Secret &amp;amp; Sharing Secret Secrets Secretly&lt;/b&gt;, Vic Vandal&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;As a presenter always err on the side of going too fast, and assuming your audience is smarter than you, this presentation sucked&lt;/li&gt;
&lt;li&gt;Steganography is more than least significant bit image modification, it generally is about hiding things in plain sight such as hiding data after the EOF character in text files&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Free Anonymous Internet Using Modified Cable Modems&lt;/b&gt;, Blake Self &amp;amp; Durandal&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I didn't actually attend this, I'm hoping Joe or Andrew will blog about it, because man did it sound cool. I'll post a link if I see anything.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;All in all this conference is absolutely amazing and eye opening. It really does give you a completely different perspective on the security industry.&lt;/p&gt; 
</description>
        
          <category term="general" label="general"/>
        
      </item>
    
      <item>
        <title>A Major Silverlight PITA and Two Annoying 3.0 Limitations</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/a_major_silverlight_pita_and.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/a_major_silverlight_pita_and.html</guid>
        <pubDate>Tue, 27 May 2008 08:52:54 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Pardon my rant, but the thing I currently hate most about Silverlight (besides copious XML) is the Visibility property. Any sane framework would implement Visibility as a Boolean. Not Silverlight though. It's creators in undoubted infinite wisdom implemented it as an enumeration. The values of the enumeration? There are two: Visible and Collapsed. Hmmm.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/05/two-annoying-30-limitations-major.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');
        redditIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(redditIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;Of course this causes superfluous verbosity in common everyday code:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;button1.Visibility = makeVisible ? &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Collapsed;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Or worse when things get a little more complex:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;// don't display the panel if its button's aren't visible&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;panel1.Visibility = !(button1.Visibility == &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible &amp;amp;&amp;amp; button2.Visibility == &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible) ? &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Collapsed;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Clearly this was done to keep Silverlight compatible with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Presentation_Foundation&quot;&gt;Windows Presentation Foundation&lt;/a&gt; (WPF) which has three values in its enumeration property (Visible, Hidden, and Collapsed). But that's just as ridiculous. Why WPF couldn't use two properties, Visible (Boolean) and NotVisibleBehavior (enumeration) is beyond me.&lt;/p&gt;
&lt;p&gt;It's ok though, because .Net 3.0 gave me a cure to any Framework shortcomings: Extension Methods. A syntactic sugar cure for all my bitterness:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; SetVisible(&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;FrameworkElement&lt;/span&gt; element, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; visible) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;element.Visibility = visible ? &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Collapsed;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; IsVisible(&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt; visibility) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; visibility == &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Fantastic, now my &quot;complex&quot; example becomes:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;// don't display the panel if its button's aren't visible&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;panel1.SetVisible(!(button1.IsVisible() &amp;amp;&amp;amp; button2.IsVisible()));&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Still not quite as nice as a Boolean visible property, but certainly doable. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;3.0 Limitation #1, By Ref Extension Methods&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;But wait. Isn't it best practice in Silverlight to use binding for these types of things? Separation of logic from presentation and all. So I should do:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; Visibility&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;Binding&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; IsPanelVisible&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;}&quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And then:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;DisplayStuff&lt;/span&gt; : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;INotifyPropertyChanged&lt;/span&gt; {&lt;span style=&quot;COLOR: blue&quot;&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt; IsPanelVisible { &lt;span style=&quot;COLOR: blue&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;COLOR: blue&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; UpdateStatus(&lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; makeVisible) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;IsPanelVisible = makeVisible ? &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Collapsed;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// make sure to notify the control that the property has changed&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;PropertyChanged(&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;, &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;PropertyChangedEventArgs&lt;/span&gt;(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;IsPanelVisible&quot;&lt;/span&gt;));&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And we can set the DataContext of some parent element to an instance of DisplayStuff and all the children including our panel magically databind. That's cool, but the ugliness is back (well, not as bad since I removed the buttons to simply the example, but you can pretend). This is because we extended FrameworkElement not Visibility. No problem, just extend Visibility right?&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; SetVisible(&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt; visibility, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; visible) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;visibility = visible ? &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Visible : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;.Collapsed;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Except this doesn't work. Can you spot the problem?&lt;/p&gt;
&lt;p&gt;It compiles. It runs. But the value of IsPanelVisible never changes. Oh yea, C# is pass by value by default. And now the .Net Framework 3.0 limitation. This isn't possible:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; SetVisible(&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt; &lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;ref&lt;/span&gt;&lt;/b&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt; visibility, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; visible) {&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You get &quot;The parameter modifier 'ref' cannot be used with 'this'.&quot; Grr.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Limitation #2, By Ref Automatic Properties&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Ok, so remove &quot;this&quot;, and go back to C# 2.0 helper functions which extension methods are syntactic sugar for anyway:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; SetVisible(&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;ref&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Visibility&lt;/span&gt;&lt;/b&gt; visibility, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; visible) {&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And now our class can do:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;ExtensionMethods&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;.SetVisible(&lt;span style=&quot;COLOR: blue&quot;&gt;ref&lt;/span&gt; IsPanelVisible, makePanelVisible);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Right? Not so fast I'm afraid. Compile error. &quot;A property or indexer may not be passed as an out or ref parameter&quot;. And I guess this is reasonable. You can't pass the address of a function, which is what a property is in the background. So you should pass the private variable that backs the property.&lt;/p&gt;
&lt;p&gt;Except that I don't have one! I used an automatic property. And .Net doesn't let me access the private variable backing the automatic property. So I'm stuck!&lt;/p&gt;
&lt;p&gt;And this is .Net 3.0 limitation #2. Automatic properties are wonderful until you try to do much with them. Why couldn't the framework notice that I'm using an automatic property and pass the variable that I can't access by ref to my function?&lt;/p&gt;
&lt;p&gt;And now I find myself back in a .Net 2.0 world because all the features I like so much in 3.0 are more sugar than substance.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Allowing automatic properties to pass by reference or allowing access to the private member behind them would be nice. Allowing extension methods to change the instance they extend would be nice. But ultimately none of this would be a problem if Visible had been implemented as a Boolean. The way every other framework in the world does. &amp;lt;/Complaining&amp;gt;&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Expression Trees: Why LINQ to SQL is Better than NHibernate</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/expression_trees_why_linq_to.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/expression_trees_why_linq_to.html</guid>
        <pubDate>Thu, 27 Mar 2008 16:59:40 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;In my last post I described how the &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html&quot;&gt;Where()&lt;/a&gt; function works for LINQ to Objects via extension methods and the yield statement. That was interesting. But where things get crazy is how the other LINQ technologies, like LINQ to SQL use extension methods. In particular it's their use of a new C# 3 feature called expression trees that makes them extremely powerful. And it's an advantage that more traditional technologies like NHibernate will never touch until they branch out from being a simple port of a Java technology. In this post I'll explain the inherent advantage conferred on LINQ technologies by expression trees and attempt to describe how the magic works.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/03/expression-trees-why-linq-to-sql-is.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');
        redditIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        var div = document.createElement('div');
        div.appendChild(dotnetkicksLink);
        div.appendChild(document.createElement('br'));
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(redditIframe);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;What's so Magic about LINQ to SQL?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;LINQ to SQL (and it's more powerful unreleased cousin &lt;a href=&quot;http://blogs.msdn.com/adonet/archive/2007/01/30/entity-data-model-part-1.aspx&quot;&gt;LINQ to Entities&lt;/a&gt;) is a new Object Relational Mapping (&lt;a href=&quot;http://en.wikipedia.org/wiki/Object-relational_mapping&quot;&gt;ORM&lt;/a&gt;) technology from Microsoft. It allows you to write something like the following:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;IEnumerable&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Product&lt;/span&gt;&amp;gt; products = northwindDataContext.Products.Where(&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;p =&amp;gt; p.Category.CategoryName == &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Beverages&quot;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Which as you'd expect returns products from the database whose category is Beverages. But wait, aren't you impressed? If not read over that code again, you should be very impressed. In the background that C# code is converted into the following SQL:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[ProductID]&lt;span style=&quot;COLOR: gray&quot;&gt;,&lt;/span&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[ProductName]&lt;span style=&quot;COLOR: gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;...&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;FROM&lt;/span&gt; [dbo]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Products] &lt;span style=&quot;COLOR: blue&quot;&gt;AS&lt;/span&gt; [t0]&lt;br /&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;LEFT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;OUTER&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;JOIN&lt;/span&gt; [dbo]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Categories] &lt;span style=&quot;COLOR: blue&quot;&gt;AS&lt;/span&gt; [t1] &lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;ON&lt;/span&gt; [t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryID] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryID]&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHERE&lt;/span&gt; [t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryName] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; @p0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In other words it's pretty smart. It isn't just returning all products and filtering them in memory using the LINQ to Objects version of Where() I discussed &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html&quot;&gt;previously&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Doing something like that using NHibernate Criteria would require something like this:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;ICriteria&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; c = session.CreateCriteria(&lt;span style=&quot;COLOR: blue&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Product&lt;/span&gt;));&lt;br /&gt;c.Add(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Expression&lt;/span&gt;.Eq(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Category.CategoryName&quot;&lt;/span&gt;, &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Beverages&quot;&lt;/span&gt;));&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Product&lt;/span&gt;&amp;gt; products = c.List&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Product&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You could use HQL too, but both NHibernate options suffer from the same problem. Did you spot it? &lt;/p&gt;
&lt;p&gt;The LINQ to SQL version is taking actual &lt;i&gt;strongly typed&lt;/i&gt; C# code and somehow smartly converting it to useful SQL. The NHibernate version does the same thing, but always using a &lt;i&gt;weakly typed&lt;/i&gt; alternative. In other words the column &quot;CategoryName&quot; in NHibernate is a string. If it or its data type change in NHibernate you won't find out until runtime. And that is the beauty of LINQ to SQL: you'll find more errors at compile time. And if you're like me you want the compiler to find your mistakes before the unit tests that you (or your fellow developers) may or may not have written do. &lt;/p&gt;
&lt;p&gt;So you're probably now wondering if you can put strongly typed C# in your where clause and it somehow magically gets converted to SQL, what's the limit? If you put in a String.ToLower() or StartsWith() will it get converted to equivalent SQL? What about a loop or conditional? A function call? A recursive function call? At some point it has to break down and either return all products and filter them in memory or just fail right? Before answering those questions we need to understand what's going on.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Understanding the Magic&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The Magic happens in a class called &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/bb335710.aspx&quot;&gt;Expression&amp;lt;T&amp;gt;&lt;/a&gt;. Expression takes a generic argument that must be a delegate and is usually one of the built in &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html&quot;&gt;Func&lt;/a&gt; methods.&amp;nbsp; However the class can only be instantiated to a lambda expression. That's right, not a delegate or anonymous method, only a Lambda expression. So in my &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/02/deferred-execution-elegance-of-linq.html&quot;&gt;deferred execution&lt;/a&gt; post where I explained what Lambda expression are, I said they were &lt;i&gt;essentially&lt;/i&gt; syntactic sugar for an anonymous methods. Well, the emphasis is on the essentially, because they really aren't sugar at all. When you assign a lambda expression to an Expression, the compiler, rather than generating the IL to evaluate the expression, generates IL that constructs an &lt;a href=&quot;http://en.wikipedia.org/wiki/Abstract_syntax_tree&quot;&gt;abstract syntax tree&lt;/a&gt; (AST) for the expression! You can then parse the tree and perform actions based on the code in the lambda expression. &lt;/p&gt;
&lt;p&gt;Below is an example adapted from the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/bb397951.aspx&quot;&gt;.Net Developer's guide&lt;/a&gt; on MSDN that shows how this works:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;// convert the lambda expression to an abstract syntax tree&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;Expression&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Func&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; expression = i =&amp;gt; i &amp;lt; 5;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ParameterExpression&lt;/span&gt; param = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ParameterExpression&lt;/span&gt;)expression.Parameters[0];&lt;br /&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// this next line would fail if we change the Lambda expression much&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;BinaryExpression&lt;/span&gt; operation = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;BinaryExpression&lt;/span&gt;)expression.Body;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ParameterExpression&lt;/span&gt; left = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ParameterExpression&lt;/span&gt;)operation.Left;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ConstantExpression&lt;/span&gt; right = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ConstantExpression&lt;/span&gt;)operation.Right;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Decomposed expression: {0} =&amp;gt; {1} {2} {3}&quot;&lt;/span&gt;,&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;param.Name, &lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;left.Name, &lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;operation.NodeType, &lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;right.Value&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This outputs &quot;Decomposed expression: i =&amp;gt; i LessThan 5&quot;. The first line is the most important. It defines an Expression that takes a delegate with a single int parameter and a return type of bool. It then instantiates the Expression to a simple lambda expression.&amp;nbsp; Incidentally this would also work if we defined our own Delegate:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;delegate&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;LessThanFive&lt;/span&gt;(&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; DoStuff() {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;LessThanFive&lt;/span&gt;&amp;gt; expression = i =&amp;gt; i &amp;lt; 5;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It would, however, not work if we used an anonymous method:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;Expression&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Func&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; expression = &lt;span style=&quot;COLOR: blue&quot;&gt;delegate&lt;/span&gt;(&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i) { &lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; i &amp;lt; 5; };&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;While that looks legal it actually results in the compile time error &quot;An anonymous method expression cannot be converted to an expression tree.&quot;&lt;/p&gt;
&lt;p&gt;There is a lot of complexity in parsing the AST, far beyond the scope of this article. However, the MSDN does have a nice diagram that helps explain how the following slightly more complicated Lambda expression that determines if a string has more letters than a number:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;Expression&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Func&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt;, &lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; expression =&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(str, num) =&amp;gt; num &amp;gt; str.Length;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/R-wLZwVrWwI/AAAAAAAAAoo/OSpE74pLxxc/s1600-h/ExpressionTrees.png&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5182529808297057026&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/R-wLZwVrWwI/AAAAAAAAAoo/OSpE74pLxxc/s400/ExpressionTrees.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;How Deep Does The Rabbit Hole Go?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So LINQ to SQL uses this Expression Tree technique to parse a plethora of possible code that you could throw at it and turn it into smart SQL. For instance check out a couple of the following conversions that LINQ to SQL will (or will not) perform:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;p =&amp;gt; p.Category.CategoryName.ToLower() == &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;beverages&quot;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Results In:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[ProductID]&lt;span style=&quot;COLOR: gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;...&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;FROM&lt;/span&gt; [dbo]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Products] &lt;span style=&quot;COLOR: blue&quot;&gt;AS&lt;/span&gt; [t0]&lt;br /&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;LEFT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;OUTER&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;JOIN&lt;/span&gt; [dbo]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Categories] &lt;span style=&quot;COLOR: blue&quot;&gt;AS&lt;/span&gt; [t1] &lt;span style=&quot;COLOR: blue&quot;&gt;ON&lt;/span&gt; [t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryID] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryID]&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHERE&lt;/span&gt; &lt;span style=&quot;COLOR: fuchsia&quot;&gt;LOWER&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;[t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryName]&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; @p0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Not bad, huh? How about:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;p =&amp;gt; p.Category.CategoryName.Contains(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;everage&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;That results in the following SQL snippet:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; [t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryName] &lt;span style=&quot;COLOR: gray&quot;&gt;LIKE&lt;/span&gt; @p0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And it sets @p0 to &quot;%everage%&quot;. Pretty cool. Ok this will get it to fail though, right?&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; GetCat() {&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return&lt;/span&gt; &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Beverages&quot;&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Product&lt;/span&gt;&amp;gt; products = northwindDataContext.Products.Where(&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;p =&amp;gt; p.Category.CategoryName == GetCat()&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It turns out that LINQ to SQL will look inside of other functions! Alright, there's no way it can do complicated conditionals:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;p =&amp;gt; p.Category.CategoryName == &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Beverages&quot;&lt;/span&gt; ? p.UnitsInStock &amp;lt; 5 : !p.Discontinued&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This should only pick up Beverages that have fewer than 5 items in stock regardless of whether they are discontinued and any other products that aren't discontinued. Would you believe that it runs a single SQL statement:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[ProductID]&lt;span style=&quot;COLOR: gray&quot;&gt;,&lt;/span&gt; ...&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;FROM&lt;/span&gt; [dbo]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Products] &lt;span style=&quot;COLOR: blue&quot;&gt;AS&lt;/span&gt; [t0]&lt;br /&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;LEFT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;OUTER&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;JOIN&lt;/span&gt; [dbo]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Categories] &lt;span style=&quot;COLOR: blue&quot;&gt;AS&lt;/span&gt; [t1] &lt;span style=&quot;COLOR: blue&quot;&gt;ON&lt;/span&gt; [t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryID] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryID]&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHERE&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;CASE&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHEN&lt;/span&gt; [t1]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[CategoryName] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; @p0 &lt;span style=&quot;COLOR: blue&quot;&gt;THEN&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;CASE&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHEN&lt;/span&gt; [t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[UnitsInStock] &lt;span style=&quot;COLOR: gray&quot;&gt;&amp;lt;&lt;/span&gt; @p1 &lt;span style=&quot;COLOR: blue&quot;&gt;THEN&lt;/span&gt; 1&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;[t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[UnitsInStock] &lt;span style=&quot;COLOR: gray&quot;&gt;&amp;lt;&lt;/span&gt; @p1&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;THEN&lt;/span&gt; 0&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;NULL&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;COLOR: fuchsia&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;Int&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;,&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;CASE&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;[t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Discontinued] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; 1&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;THEN&lt;/span&gt; 1&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;[t0]&lt;span style=&quot;COLOR: gray&quot;&gt;.&lt;/span&gt;[Discontinued] &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; 1&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;THEN&lt;/span&gt; 0&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;NULL&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;))&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;=&lt;/span&gt; 1&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Wow, it sure isn't pretty, but it scales to multiple conditionals, and most importantly it didn't return all products and process them in memory. Not bad.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I asserted up front that using expression trees and the strong typing that comes with them is the reason LINQ to SQL is inherently better that NHibernate. I really can't make that claim without admitting one of LINQ to SQL's biggest shortcomings: It currently does not support &lt;a href=&quot;http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=299807&quot;&gt;multiple table inheritance&lt;/a&gt;. Ultimately, however, it's a short term fault since the forthcoming LINQ to Entities does. And I stand by my claim because from a long term perspective as long as technologies like NHibernate remain pure ports of Java code they will never realize the full benefits of equivelant LINQ technologies that take advantage of .Net's native strengths: like expression trees.&lt;/p&gt;
&lt;hr&gt;

&lt;p&gt;Note: Please post comments to my &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/expression-trees-why-linq-to-sql-is.html&quot;&gt;blogspot blog&lt;/a&gt;&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>How System.Linq.Where() Really Works</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/how_system_linq_where_really.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/how_system_linq_where_really.html</guid>
        <pubDate>Fri, 14 Mar 2008 14:53:47 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;After writing my last blog entry on &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/02/deferred-execution-elegance-of-linq.html&quot;&gt;Deferred Execution in LINQ&lt;/a&gt; I had a conversation with &lt;a href=&quot;http://www.nearinfinity.com/blogs/page/seths&quot;&gt;Seth Schroeder&lt;/a&gt; who rightly pointed out among other things that I really didn't show how LINQ's deferred execution works internally. So in this post I wanted to implement my own LINQ &lt;i&gt;Where()&lt;/i&gt; extension method based off of the one in the System.Linq namespace. So I'll show you the code, explain interesting parts of how it works including collection initializiers and extension methods, and then explain where the deferred execution behavior comes from (i.e. the yield statement). I will only explain in the context of LINQ to Objects since that's far simpler than other Linq's. I will implement a Where() like LINQ to SQL does in a later blog post (that's where things get really crazy).&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;Implementing MyWhere()&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Let's start out with some code. The first question is does this compile?&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; System;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;using&lt;/span&gt; MyExtensionMethods;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;namespace&lt;/span&gt; PlayingWithLinq {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;LinqToObjects&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; DoStuff() {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IList&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; ints = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;() {9,8,7,6,5,4,3,2,1};&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; result = ints.MyWhere(i =&amp;gt; i &amp;lt; 5);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; result) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Console&lt;/span&gt;.WriteLine(i);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;namespace&lt;/span&gt; MyExtensionMethods {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;ExtensionMethods&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;TSource&amp;gt; MyWhere&amp;lt;TSource&amp;gt;(&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;TSource&amp;gt; source,&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Func&lt;/span&gt;&amp;lt;TSource, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt;&amp;gt; predicate&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;) {&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (TSource element &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; source) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;if&lt;/span&gt; (predicate(element)) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;yield&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; element;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Side note: putting two namespaces in on file is far from a best practice, but yes that is allowed. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;Lambdas and Collection Initializers&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you're new to C# 3.5 then your first thought may be that:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;IList&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; ints = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;() {9,8,7,6,5,4,3,2,1};&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;is not allowed. Actually it is. It's the &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/03/08/new-c-orcas-language-features-automatic-properties-object-initializers-and-collection-initializers.aspx&quot;&gt;collection initializer syntax&lt;/a&gt; that I initially whined about in my post &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/04/c-30-sweet-and-sour-of-syntactic-sugar.html&quot;&gt;C# 3.0: The Sweet and Sour of Syntactic Sugar&lt;/a&gt; (ironically I actually like this syntax the more I use it.)&lt;/p&gt;
&lt;p&gt;Your next thought may be that:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;i =&amp;gt; i &amp;lt; 5&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;is not legitimate. This is in fact a &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx&quot;&gt;Lambda Expression&lt;/a&gt;, and as I explained in &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/02/deferred-execution-elegance-of-linq.html&quot;&gt;Deferred Execution, The Elegance of LINQ &lt;/a&gt;it conceptually compiles down to an anonymous method. Incidentally those that know Groovy (myself not included) or Lisp may know this as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Closure_(computer_science)&quot;&gt;closure&lt;/a&gt; since as we'll see later it can access local variables.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Extension Methods&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Ok, the .Net Framework certainly has no MyWhere() function on the List object so this certainly wouldn't compile in C# 2. But that's where C# 3's &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx&quot;&gt;Extension Methods&lt;/a&gt; come in. The &quot;this&quot; in:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;MyWhere&amp;lt;TSource&amp;gt;(&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;&lt;/b&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&amp;lt;TSource&amp;gt; source&lt;/b&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;says that MyWhere() can be applied to any generic IEnumerable. If you want to, you can still call MyWhere() normally:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;IList&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; ints = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;() {9,8,7,6,5,4,3,2,1};&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;ExtensionMethods&lt;/span&gt;.MyWhere(ints, i =&amp;gt; i &amp;lt; 5);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And in fact this is what the compiler does in the background when you call MyWhere() off of an IEnumerable. But now with extension methods you don't have to.&lt;/p&gt;
&lt;p&gt;But does MyWhere() now exist on all IEnumerable objects everywhere? No, it turns out you only get MyWhere() when you import the namespace it exists in (MyExtensionMethods). Incidentally unlike Groovy and Ruby there is no way to add an extension method to a class itself, only to instances.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Whose got the Func()?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The last two questionable parts of the code are the Func&amp;lt;TSource, bool&amp;gt; and the yield. Func is pretty easy. It's simply one of several new predefined &lt;a href=&quot;http://en.wikipedia.org/wiki/Delegate_(.NET)&quot;&gt;delegates&lt;/a&gt; (method signatures) that comes with the .Net framework off of the System namespace. The two generic argument one above will match any function that returns the second generic argument and takes the first generic argument as a parameter. It looks like this:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;delegate&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; TResult &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Func&lt;/span&gt;&amp;lt;T, TResult&amp;gt;(T arg1);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So rather than using a Lambda expression in my initial example I could have been very explicit about the delegate instance (myFunc):&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; DoStuff() {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IList&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; ints = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;() {9,8,7,6,5,4,3,2,1};&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Func&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;, &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt;&amp;gt; myFunc = IsSmall;&lt;br /&gt;&lt;/b&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; result = ints.MyWhere&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;(&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;myFunc&lt;/b&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; result) {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Console&lt;/span&gt;.WriteLine(i);&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;bool&lt;/span&gt; IsSmall(&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i) {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; i &amp;lt; 5;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And that would have done the same thing. Notice I had to specify the generic type on the call to MyWhere() since the compiler can't infer the type in this example.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Yield&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Now the really interesting part: &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/9k7k7cf0.aspx&quot;&gt;yield&lt;/a&gt;. Yield is what makes deferred execution work. It actually was introduced with C# 2.0, but I don't think anyone really used it (I didn't know about it until recently). So because MyWhere() returns an IEnumerable (and because it isn't anonymous and doesn't have ref or out parameters) it is allowed to use the yield statement. When a method has a yield return (or yield break) statement, then execution of the method doesn't even begin until a calling method first iterates over the resulting IEnumerable. Execution then begins in the method and runs to the first yield statement, returns a result, and passes execution back to the caller. When the calling method iterates to the next value execution continues in the method where it left off until it gets to the next yield statement and then it passes execution back to the caller again and so on. Weird huh? &lt;a href=&quot;&quot;&gt;Joshua Flanagan&lt;/a&gt; has a nice article that explains this in more detail along with some of the nice benefits like a smaller memory footprint.&lt;/p&gt;
&lt;p&gt;So here's a quiz. What happens when you execute the following code?&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;IList&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; ints = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;() {9,8,7,6,5,4,3,2,1};&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; result = ints.MyWhere&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;(i =&amp;gt; i &amp;lt; 4);&lt;br /&gt;&lt;br /&gt;ints.Add(0);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; result) {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Console&lt;/span&gt;.WriteLine(i);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Without the yield you'd get the numbers 3 through 1 since you added 0 after the call to MyWhere(). But since the yield in MyWhere() (and the Where() in System.Linq) defers execution until the foreach statement, you actually get 3 through 0. Ready for a little more mind bending? How about this:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;IList&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; ints = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;() {9,8,7,6,5,4,3,2,1};&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; j = 4;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt; result = ints.MyWhere&amp;lt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;&amp;gt;(i =&amp;gt; i &amp;lt; j);&lt;br /&gt;&lt;br /&gt;ints.Add(0);&lt;br /&gt;j = 3;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; result) {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Console&lt;/span&gt;.WriteLine(i);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Does the state of j get captured? My intuition would say yes. If so you'd expect 3 through 0. Well, the closure part of anonymous methods and lambdas work by keeping a reference to their calling object (this). So consequently they always get the most up to date value of a variable. So if your intuition works like mine you'd be wrong. You actually get the numbers 2 through 0. Crazy huh? And definitely something I hope I won't run into in someone's code (&lt;a href=&quot;http://www.jetbrains.com/resharper/&quot;&gt;JetBrains ReSharper&lt;/a&gt; actually warns you if you do something crazy like this).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If this made sense then you should have a pretty solid grasp of how most of Linq to Objects works. Understanding extension methods, Func delegates, and yield statements should form the majority of what Linq does. Well, except for expression trees. But that's a topic for another post. Please post if this doesn't make sense or if I got it all wrong, I'd love to hear from you.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;P.S. To comment on this article please use &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/03/how-systemlinqwhere-really-works.html&quot;&gt;my public Blog&lt;/a&gt;.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Deferred Execution, the Elegance of LINQ</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/deferred_execution_the_elegance_of.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/deferred_execution_the_elegance_of.html</guid>
        <pubDate>Wed, 20 Feb 2008 09:45:58 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;One of the things I love about LINQ is its deferred execution model. It's the type of thing that makes sense academically when you first read about it (e.g. in &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx&quot;&gt;Part Three&lt;/a&gt; of Scott Gunthrie's LINQ to SQL series), but for me anyway, it took some time to understand enough to use effectively.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/02/deferred-execution-elegance-of-linq.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;For instance the &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2008/02/daily-rss-download.html&quot;&gt;Daily RSS Download&lt;/a&gt; open source application that I wrote about last week needs to download entries (posts) that are newly published since the last download. While it isn't a complicated problem, my first attempt at a solution didn't use the power of LINQ correctly. I'll explain my naâ€¢ve solution in this post, describe how LINQ's deferred execution works (i.e. Lambda expressions), explain the problems with my solution, then give an the elegant solution that is only possible because of LINQ's deferred execution model. See if you can spot my error along the way.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Downloading the Latest Entries&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Downloading the latest entries would be a ridiculously simple problem if there weren't multiple formats for RSS. But since the solution needs to support Atom and RSS 2.0 and 1.0 and potentially other future formats, the class structure should be set up appropriately:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp3.blogger.com/_gez10dNhuPk/R7wv8TOwvgI/AAAAAAAAAog/ValJzmKGsRg/s1600-h/01-ClassDiagram.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5169059185315331586&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/R7wv8TOwvgI/AAAAAAAAAog/ValJzmKGsRg/s400/01-ClassDiagram.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The newspaper class primarily exists to enumerate feeds:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Newspaper&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; DownloadNow() {&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Feed&lt;/span&gt; objFeed &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; Settings.Feeds) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;objFeed.DownloadRecentEntries(...);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The Feed class is abstract and during runtime is either an RssFeed or an AtomFeed. The relevant function Feed.DownloadRecentEntries() calls the abstract Feed.GetEntries() method, which returns a group of Entry objects. &lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Feed&lt;/span&gt; {&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; GetEntries(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt; rssfeed);&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; DownloadRecentEntries(&lt;span style=&quot;COLOR: blue&quot;&gt;...&lt;/span&gt;) {&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;XDocument&lt;/span&gt; xdocFeed = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt;.Load(Url);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; lstRecentPosts = GetEntries(xdocFeed);&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt; objEntry &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; lstRecentPosts) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;objEntry.Download(...)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;br /&gt;}&lt;br style=&quot;mso-special-character: line-break&quot; /&gt;&lt;br style=&quot;mso-special-character: line-break&quot; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The Feed classes, RssFeed and AtomFeed then implement GetEntries as follows:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;publpublic&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;RssFeed&lt;/span&gt; : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Feed&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; GetEntries(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt; rssfeed) {&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;from&lt;/span&gt; item &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; rssfeed.Descendants(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;item&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;where&lt;/span&gt; (DateParser.ParseDateTime(item.Element(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;pubDate&quot;&lt;/span&gt;).Value) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;gt;= &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;|| &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded == &lt;span style=&quot;COLOR: blue&quot;&gt;null&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;select&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;)&lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;RssEntry&lt;/span&gt;(item, &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;AtomFeed&lt;/span&gt; : &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Feed&lt;/span&gt; {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; GetEntries(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt; rssfeed) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;from&lt;/span&gt; item &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; rssfeed.Descendants(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;entry&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;where&lt;/span&gt; (DateParser.ParseDateTime(&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;item.Element(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;published&quot;&lt;/span&gt;).Value) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;gt;= &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;|| &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded == &lt;span style=&quot;COLOR: blue&quot;&gt;null&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;select&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;)&lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;AtomEntry&lt;/span&gt;(item, &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Yes, that's all LINQ to XML in there. It looks a lot like SQL, but as you'll see in a second it's really just glorified syntactic sugar. Expressive though, isn't it? While the astute reader may have already spotted the inelegance of my solution, for those unfamiliar with LINQ, let's first describe what AtomFeed.GetEntries() does.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;What is this Deferred Execution Stuff?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you already understand LINQ and how delayed execution works feel free to skip this section. For everyone else it's important to understand that the following line:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; item &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; rssfeed.Descendants(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;item&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;where&lt;/span&gt; (DateParser.ParseDateTime(item.Element(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;pubDate&quot;&lt;/span&gt;).Value) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;gt;= &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;|| &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded == &lt;span style=&quot;COLOR: blue&quot;&gt;null&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;select&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;)&lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;RssEntry&lt;/span&gt;(item, &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is actually just syntactic sugar for the following set of statements:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;rssfeed&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;.Descendants&lt;/b&gt;(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;entry&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;.Where&lt;/b&gt;( item =&amp;gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;DateParser&lt;/span&gt;.ParseDateTime(&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;item.Element(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;published&quot;&lt;/span&gt;).Value) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;gt;= &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;|| &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded == &lt;span style=&quot;COLOR: blue&quot;&gt;null&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;.Select&lt;/b&gt;( item =&amp;gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;)&lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;AtomEntry&lt;/span&gt;(item, &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;));&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now XDocument.Descendants() returns IEnumerable&lt;xelement&gt; which most definitely does not have a Where() function on it. And if you look at the return type of Where() &lt;i&gt;in this context&lt;/i&gt;, it returns an IEnumerable&lt;xelement&gt; which definetly does not have a Select() method on it. That's because Where() and Select() are &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx&quot;&gt;extension methods&lt;/a&gt;, meaning you can attach them on to just about anything. They're new to C# 3.0 and are beyond the scope of this article.&lt;/p&gt;
&lt;p&gt;But more important for the topic of deferred execution is the =&amp;gt; operator, which is a &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx&quot;&gt;Lambda expression&lt;/a&gt; and is also new to C# 3.0. The best way to understand them is that they are &lt;i&gt;essentially&lt;/i&gt; syntactic sugar for an &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/0yw3tz5k(VS.80).aspx&quot;&gt;anonymous method&lt;/a&gt; (e. (e.g. a type safe function pointer to code). So we could again rewrite our code as follows:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;rssfeed&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Descendants(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;entry&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Where(&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;delegate&lt;/span&gt;(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XElement&lt;/span&gt; item) { &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;DateParser&lt;/span&gt;.ParseDateTime(&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;item.Element(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;published&quot;&lt;/span&gt;).Value) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;gt;= &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded) || &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded == &lt;span style=&quot;COLOR: blue&quot;&gt;null&lt;/span&gt;; }&lt;/b&gt;)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Select(&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;delegate&lt;/span&gt;(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XElement&lt;/span&gt; item) { &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;)&lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;AtomEntry&lt;/span&gt;(item, &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;); }&lt;/b&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Back in familiar territory yet? If not you probably aren't familiar with C# 2.0. In the background the compiler takes the anonymous methods above and turns them into methods on the current class and instantiates new delegates of the correct type that points to them and passes them to the Select() and Where() methods. 
&lt;p&gt;The The key thing to note is that the arguments for select and where are delegates, and so when those delegates are executed is beyond our control. In fact if you put a Console.WriteLine or a breakpoint inside of the AtomEntry constructor, it won't get called until the resulting IEnumerable is enumerated, specifically the following line in the first code sample:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;foreach&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt; objEntry &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; lstRecentPosts) {&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So that's delayed execution. But understanding how it works and how to use it are completely different things.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;The Inelegant Solution&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Getting back to my code sample you may have picked up that my where clause is the mistake. I implemented it like this because RSS and Atom have different field names for the published date. But the way I wrote it I'd have to make two changes if I wanted to change which entries to download. Ok, big deal, I'm extremely unlikely to make changes to that where clause right? Or I wasn't until I wanted functionality to set some defaults based on the average length of posts prior to downloading posts. Basically:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; Feed CreateFeed(&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; strUrl, &lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intDisplayOrder) {&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IEnumerable&lt;/span&gt;&amp;lt;Entry&amp;gt; lstRecentEntries = feed.GetEntries(rssfeed);&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;double&lt;/span&gt; intAveragePostSize = lstRecentEntries.Average(&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i =&amp;gt; i.Description.Length);&lt;br /&gt;&lt;span style=&quot;COLOR: green&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// if the feeds posts are typically small then include the &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// description field in the summary and download the content &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// for the main article from the link&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;if&lt;/span&gt; (intAveragePostSize &amp;lt; 1000) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;} else {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Except this now ties me to the were clause, when what I'd really like to do is just get the average post size for the last couple of posts. The problem is that GetEntries() isn't generic enough.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;The Elegant Solution&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The The solution is then to normalize out (excuse the database terminology) the where clause into the two methods that use GetEntries(). So GetEntries() becomes simple:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; GetEntries(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt; rssfeed) {&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;from&lt;/span&gt; item &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; rssfeed.Descendants(_atomNamespace + &lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;entry&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 2&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;select&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;)&lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;AtomEntry&lt;/span&gt;(item, &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And then Feed.CreateFeed() and Feed.DownloadRecentEntries() become more complicated&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Feed&lt;/span&gt; {&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;abstract&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; GetEntries(&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt; rssfeed);&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; Feed CreateFeed(&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; strUrl, &lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intDisplayOrder) {&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; lstEntries = feed.GetEntries(rssfeed);&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// get the five most recent posts&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; lstRecentEntries = &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;from&lt;/span&gt; entry &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; lstEntries.Take(5)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;select&lt;/span&gt; entry;&lt;/b&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;double&lt;/span&gt; intAveragePostSize = lstRecentEntries.Average(&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;i =&amp;gt; i.Description.Length);&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;if&lt;/span&gt; (intAveragePostSize &amp;lt; 1000) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;...&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;} else {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;...&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;void&lt;/span&gt; DownloadRecentEntries(&lt;span style=&quot;COLOR: blue&quot;&gt;...&lt;/span&gt;) {&lt;br /&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;XDocument&lt;/span&gt; xdocFeed = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;XDocument&lt;/span&gt;.Load(Url);&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; lstEntries = GetEntries(xdocFeed);&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// get newly published posts&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt;&amp;gt; lstRecentPosts = &lt;span style=&quot;COLOR: blue&quot;&gt;from&lt;/span&gt; entry &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; lstEntries&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;where&lt;/span&gt; (entry.Published &amp;gt;= &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded) &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;|| &lt;span style=&quot;COLOR: blue&quot;&gt;this&lt;/span&gt;.LastDownloaded == &lt;span style=&quot;COLOR: blue&quot;&gt;null&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;select&lt;/span&gt; entry;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Entry&lt;/span&gt; objEntry &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; lstRecentPosts) {&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;objEntry.Download(...)&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Note that we now have a second LINQ statement that runs against the results of the LINQ statement in GetEntries(). But since nothing's been executed yet we're just building out the statement that we will eventually run when the resulting IEnumerable if enumerated. So we've now spread our LINQ statements across an inheriting and a base class, and in process we've made GetEntries() extremely generic.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So what's the big deal? The big deal is that we can spread our data access statements across multple classes and because of deferred execution we don't need to worry about the performance of generic methods that are closer to the data that don't contain a &quot;where&quot; clause. This may not be a huge deal in this example, but it becomes extremely powerful when the user interface tier can tack on &quot;order by&quot; statements or &quot;filters&quot; BEFORE anything is executed against your data store. And that, for me, is at the heart of the beauty of LINQ.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Daily RSS Download</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/daily_rss_download.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/daily_rss_download.html</guid>
        <pubDate>Thu, 14 Feb 2008 11:29:00 -0500</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I published &lt;a href=&quot;http://www.codeplex.com/dailyrssdownload&quot;&gt;Daily RSS Download&lt;/a&gt;, my first open source project on CodePlex* today. It's not going to change the world, but if you have a need for it there is a decided lack of decent products that perform this functionality. In this post I'll give a little background about why I wrote it and explain what it does and how to use it. Besides needing this functionality I also wrote it to learn LINQ to Objects and LINQ to XML, but I'll cover the more interesting implementation details in a later post. &lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2008/02/daily-rss-download.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;Why I Wrote It&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;For Christmas I received an &lt;a href=&quot;http://www.irextechnologies.com/products/iliad&quot;&gt;IRex Iliad&lt;/a&gt; which is an e-book reader combined with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Wacom&quot;&gt;Wacom tablet&lt;/a&gt;. It's an awesome product that allows reading PDF's (among other formats) and writing on them. It's pricey, but the ability to jot notes on technical documents (in addition to recipes and guitar tablature, etc) as you read is invaluable for me. I now read about twice as much as I did before. It supports Wi-Fi, and in particular can connect to a computer on a regular basis to download files you put in a specific directory. &lt;/p&gt;
&lt;p&gt;So theoretically it could download a customized newspaper every morning for me, right? I could have today's world news, national news, local news, technical news, weather, and my RSS feeds like Scott Gunthrie all in one place while I eat my cereal! And then I could cancel my Washington Post subscription and after about 7.5 years I would have recouped the costs of the Iliad. Sweet.&lt;/p&gt;
&lt;p&gt;The problem is that the product doesn't come with any way to download RSS feeds. Well, you can use software from &lt;a href=&quot;http://www.mobipocket.com/&quot;&gt;MobiPocket&lt;/a&gt;, but it's a pain to setup, and use, and I couldn't figure out how to have it automatically run on a daily basis. And furthermore it can't grab the real content from the website if the RSS feed only contains an abstract (e.g. washingtonpost.com). I searched and there was some software out there, but none of it did what I liked. And of course none of it generated a manifest.xml file which is an Iliad specific file that links HTML pages together and gives names to groups of content (i.e. grouping the files in a directory to make a &quot;book&quot; called &quot;My Daily News for February 13&quot;).&lt;/p&gt;
&lt;p&gt;So what a great opportunity to write it myself and learn LINQ to XML and LINQ to Objects in the process.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;What It Does&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The end result (or the index page anyway) looks something like this:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/R7RWazOwvfI/AAAAAAAAAoY/E18rTjgTL8Q/s1600-h/03+-+Index.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5166849690929511922&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/R7RWazOwvfI/AAAAAAAAAoY/E18rTjgTL8Q/s400/03+-+Index.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The images are local, the links go to a full page of content, and on the Iliad, because Daily RSS Download generates a manifest.xml, the next and previous buttons can move you to the next or previous article and you can see at a glance how many articles there are.&lt;/p&gt;
&lt;p&gt;If you want to recreate the screenshot above, first head over to the &lt;a href=&quot;http://www.codeplex.com/dailyrssdownload/Release/ProjectReleases.aspx&quot;&gt;Releases&lt;/a&gt; page of &lt;a href=&quot;http://www.codeplex.com/dailyrssdownload&quot;&gt;Daily RSS Download&lt;/a&gt;, where you can download the msi and install the application. When you open &quot;Daily RSS Download Config&quot; you can view a home page like this:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp3.blogger.com/_gez10dNhuPk/R7RWaTOwvdI/AAAAAAAAAoI/epxp7tgeLX4/s1600-h/01+-+Main+Screen.jpg&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/R7RWaTOwvdI/AAAAAAAAAoI/epxp7tgeLX4/s400/01+-+Main+Screen.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can type in an RSS or Atom URL and click Add Feed. The application will try to connect to the website, download the title, and set some configuration options based on the average length of posts (specifically if you put in a feed from the washingtonpost.com website it will detect that the average post size is small and determine that it should download the main content from the website).&lt;/p&gt;
&lt;p&gt;You can click on any of the feeds you've added and you'll get a Feed Settings page like below:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/R7RWajOwveI/AAAAAAAAAoQ/leZ_u_MzSA4/s1600-h/02+-+Feed+Settings.jpg&quot;&gt;&lt;img id=&quot;Img2&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/R7RWajOwveI/AAAAAAAAAoQ/leZ_u_MzSA4/s400/02+-+Feed+Settings.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The fields are mostly self explanatory, but here are three of the more interesting settings:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary Source Values:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This setting determines where the abstract (summary) on the index page should come from. There are three options:&lt;/p&gt;
&lt;p&gt;No Summary - Does not display a summary on the index.html page. This is what Scott Gunthrie's feed was set to in the first screenshot.&lt;/p&gt;
&lt;p&gt;Extract from the content - This takes the first 300 characters from the main content as the summary. This was set for the washingtonpost.com feed in the first screenshot (although Use the RSS description field would actually have been more appropriate).&lt;/p&gt;
&lt;p&gt;Use the RSS description field - This uses the entire description field from the RSS (or Atom) feed. This is what the weatherbug feed was set to in the first screenshot. Obviously this is a bad choice for a Scott Gunthrie type of RSS entry since he posts everything in the description field.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Content Source Values:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This setting determines where the main content page should get it's value. There are thee options:&lt;/p&gt;
&lt;p&gt;No content, summary only - If you set a feed to this, then Daily RSS Download won't generate a content file. This would be a good choice for the weather feed in the example.&lt;/p&gt;
&lt;p&gt;Use the RSS description field - The content file will be created from the RSS description field. This would be a good choice for a Scott Gunthrie type of feed.&lt;/p&gt;
&lt;p&gt;Download from the referenced web page -Daily RSS Download will download the page referenced by the RSS or Atom feed. This would be a good option for a washingtonpost.com type of feed.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Content Start/End Markers&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;These are regular expressions that are used if you set content source to download the referenced web page. You can leave them blank or you can set them if you want to try to strip out header, footer, navigation bars, etc. The content start marker in the screenshot:&lt;/p&gt;
&lt;p&gt;\&amp;lt;div id=\&quot;article_body\&quot;[^\&amp;gt;]*\&amp;gt;&lt;/p&gt;
&lt;p&gt;Says match '&amp;lt;div id=&quot;article_body&quot;' up through to the next '&amp;gt;'. Both markers are exclusive (the thing your matching on won't be included in the results).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Customizing the CSS&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So that's it for the general settings and use. You can click &quot;Download Now&quot; on the main config page to download your feeds, and you can set it up to run on a recurring basis (it will only download new content) by setting a recurring task to run &quot;DailyRssDownload.exe DownloadNow&quot;. The only other thing of interest is to make the content more pretty.&lt;/p&gt;
&lt;p&gt;The generated HTML is CSS customizable, so in order to get the two column look above (and/or make it look pretty on an Iliad) you can customize the CSS as below:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;h1&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;{&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;margin-top&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;0px&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;/* A pretty linux script font since the Iliad has a linux kernel */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;font-family&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;Zapf&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;Chancery&lt;/span&gt;; &lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;font-size&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;30pt&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;margin-bottom&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;0px&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;h2&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;.NewsHeader&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;border-bottom&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;solid&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;1px&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;black&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;text-align&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;center&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;.DailyRss_Date&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;text-align&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;center&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;.DailyRss_Feed&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;.DailyRss_Entry&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;.DailyRss_EvenEntry&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;.DailyRss_OddEntry&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: green&quot;&gt;/* LEFT COLUMN */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;#ScottGusBlog&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;float&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;left&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;49%&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;border-right&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;solid&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;1px&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;gray&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;#washingtonpostcom-TodaysHighlights&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;clear&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;both&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;float&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;left&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;49%&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;border-right&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;solid&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;1px&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;gray&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;COLOR: green&quot;&gt;/* RIGHT COLUMN */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: #a31515&quot;&gt;#WeatherBugLocalWeatherfor20190&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style=&quot;mso-tab-count: 1&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: red&quot;&gt;margin-left&lt;/span&gt;: &lt;span style=&quot;COLOR: blue&quot;&gt;50%&lt;/span&gt;;&lt;br /&gt;}&lt;br style=&quot;mso-special-character: line-break&quot; /&gt;&lt;br style=&quot;mso-special-character: line-break&quot; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So basically just use the old float left, width 50%, margin-left 50% trick to get the pretty two-column look (without tables).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I hope you find the Daily RSS Download open source project useful. Please feel free to submit suggestions, feature requests, defects or preferably defects AND patches on the project's CodePlex home page.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;* In case you aren't aware &lt;a href=&quot;http://en.wikipedia.org/wiki/Codeplex&quot;&gt;CodePlex&lt;/a&gt; is an open source project hosting website from Microsoft. It's similar to Source Forge, except there is no approval process for new projects and it integrates nicely with Visual Studio. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Create Data Disaster: Avoid Unique Indexes (Mistake 3 of 10)</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/create_data_disaster_avoid_unique.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/create_data_disaster_avoid_unique.html</guid>
        <pubDate>Thu, 30 Aug 2007 19:54:53 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I really enjoyed &lt;a href=&quot;http://www.nearinfinity.com/blogs/page/seths&quot; dtid=&quot;1125899906842629&quot;&gt;Seth Schroeder&lt;/a&gt;'s &lt;a href=&quot;http://www.nearinfinity.com/blogs/page/lrichard?entry=surrogate_keys_data_modeling_mistake#comment1&quot; dtid=&quot;1125899906842630&quot;&gt;critique&lt;/a&gt; of the last post in my ten part data modeling mistake series: &lt;a href=&quot;editor-content.html??&quot; dtid=&quot;1125899906842631&quot;&gt;Surrogate vs Natural Primary Keys&lt;/a&gt;. His argument regarding data migration in particular sheds light on a major shortcoming of using surrogate keys: they lead data modelers to a false sense of security regarding the uniqueness of data. Specifically if modelers ignore uniqueness constraints they allow duplicate data. And as Seth points out this has a nasty side effect of disallowing any clear way to compare data between systems. But there are other problems too.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/08/create-data-disaster-avoid-unique.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p dtid=&quot;1125899906842632&quot;&gt;So, in this post I'll address the uniqueness problem introduced with surrogate keys by way of an example, I'll provide two how-to's, one implementing uniqueness in Visio and one in NHibernate, I'll explain the difference between unique indexes and unique constraints, and finally I'll provide reasons why unique indexes might be overlooked, specifically by providing a critique of ORM tools.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842633&quot;&gt;&lt;b dtid=&quot;1125899906842634&quot;&gt;Surrogate Keys = Data Disaster?&lt;/b&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842635&quot;&gt;So as mentioned above the biggest problem with surrogate keys is they lull junior data modelers or lazy developers into thinking they don't need to worry about indexes. But they do; and it's as vital as implementing &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/07/referential-integrity-data-modeling.html&quot; dtid=&quot;1125899906842636&quot;&gt;referential integrity&lt;/a&gt;. And for the same reason: data integrity.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842637&quot;&gt;As an example, imagine you're modeling a simple &lt;i dtid=&quot;1125899906842638&quot;&gt;Country&lt;/i&gt; table. You could of course use CountryName as the primary key, but as you know from my post on &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/08/in-case-youre-new-to-series-ive.html&quot; dtid=&quot;1125899906842639&quot;&gt;surrogate keys&lt;/a&gt;, you would have problems with varchar join speed (assuming you disagree with Seth that it's a premature optimization) and to a lesser extent cascading updates (since country names do occasionally change).&lt;/p&gt;
&lt;p dtid=&quot;1125899906842640&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RtdLjeB8eiI/AAAAAAAAAKE/dQr8OWfacPQ/s1600-h/01+-+Still+Bad.jpg&quot; dtid=&quot;1125899906842641&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5104631775376472610&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RtdLjeB8eiI/AAAAAAAAAKE/dQr8OWfacPQ/s400/01+-+Still+Bad.jpg&quot; border=&quot;0&quot; dtid=&quot;1125899906842642&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842643&quot;&gt;Introducing a surrogate key (CountryId) resolves these issues, but you also remove an inherent advantage that natural keys have: they require uniqueness in country names. In other words you can now have two New Zealand's and the system wouldn't stop you.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842644&quot;&gt;What's the big deal? &lt;i dtid=&quot;1125899906842645&quot;&gt;Country&lt;/i&gt; seems like a pretty benign table to have duplicates, right? Your users from New Zealand simply have an extra list item in their drop down to pick from and some pick one and some pick the other. &lt;/p&gt;
&lt;p dtid=&quot;1125899906842646&quot;&gt;For &lt;i dtid=&quot;1125899906842647&quot;&gt;Country&lt;/i&gt; one problem comes in reporting. Consider delivering a revenue by &lt;i dtid=&quot;1125899906842648&quot;&gt;Country&lt;/i&gt; report. Your report probably lists New Zealand twice and a quick scan by an exec sees half of the actual revenue for that country that they should. And as a result numerous innocent sheep are slaughtered&amp;nbsp;... uh, or something.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842649&quot;&gt;Another major problem could come in syncing data with other systems. How do those systems know which record to use?&lt;/p&gt;
&lt;p dtid=&quot;1125899906842650&quot;&gt;As you can imagine the problem is even worse with major entities like Customer, Order, Product, or something more scary like Airline Flights. And the longer the system stays in production, the more production data the system collects, the more duplicates rack up, and the more time and money that will be required to clean up the data when the problem is finally identified. In short the bigger the data disaster.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842651&quot;&gt;&lt;b dtid=&quot;1125899906842652&quot;&gt;How To #1: Visio&lt;/b&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842653&quot;&gt;So the solution is to add at least one unique constraint (or index) to every single table. In other words if you have a table without a uniqueness constraint chances are very good you''ve done something wrong.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842654&quot;&gt;The good news is that it's pretty easy to implement once you agree it's necessary. If you're modeling with Microsoft Visio this is a six step process:&lt;/p&gt;
&lt;p dtid=&quot;1125899906842655&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RtdLjeB8ejI/AAAAAAAAAKM/KWTH3-60ixY/s1600-h/02+-+Visio+How+To.jpg&quot; dtid=&quot;1125899906842656&quot;&gt;&lt;img id=&quot;Img1&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RtdLjeB8ejI/AAAAAAAAAKM/KWTH3-60ixY/s400/02+-+Visio+How+To.jpg&quot; border=&quot;0&quot; dtid=&quot;1125899906842657&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ol dtid=&quot;1125899906842658&quot;&gt;
&lt;li dtid=&quot;1125899906842659&quot;&gt;Select the table. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842660&quot;&gt;Select the &quot;Indexes&quot; category. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842661&quot;&gt;Click New. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842662&quot;&gt;No need to enter a name, just click OK. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842663&quot;&gt;Select either &quot;Unique constraint only&quot; or &quot;Unique index only&quot; (more on this decision later). &lt;/li&gt;
&lt;li dtid=&quot;1125899906842664&quot;&gt;Double click the column(s) to add. &lt;/li&gt;&lt;/ol&gt;
&lt;p dtid=&quot;1125899906842665&quot;&gt;Then when you generate or update your database Visio puts in DBMS specific uniqueness constraints. And voila, problem solved.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842666&quot;&gt;&lt;b dtid=&quot;1125899906842667&quot;&gt;Unique Constraints vs Unique Indexes&lt;/b&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842668&quot;&gt;The question will come up when using Visio or perhaps using various DBMS's including SQL Server whether to use a unique constraint or unique index. The short answer is that most people use unique constraints, but ultimately they're the same thing so it doesn't matter. &lt;/p&gt;
&lt;p dtid=&quot;1125899906842669&quot;&gt;In case you're interested in the details though here's a quick rundown of the differences:&lt;/p&gt;
&lt;p dtid=&quot;1125899906842670&quot;&gt;Unique Constraint&lt;/p&gt;
&lt;ul dtid=&quot;1125899906842671&quot;&gt;
&lt;li dtid=&quot;1125899906842672&quot;&gt;A logical construct. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842673&quot;&gt;Defined in the ANSI SQL standard. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842674&quot;&gt;Intent: data integrity. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842675&quot;&gt;Usually part of a table definition. &lt;/li&gt;&lt;/ul&gt;
&lt;p dtid=&quot;1125899906842676&quot;&gt;Unique Index&lt;/p&gt;
&lt;ul dtid=&quot;1125899906842677&quot;&gt;
&lt;li dtid=&quot;1125899906842678&quot;&gt;A physical DBMS implementation. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842679&quot;&gt;Not specified in ANSI SQL. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842680&quot;&gt;Intent: performance. &lt;/li&gt;
&lt;li dtid=&quot;1125899906842681&quot;&gt;Usually external to a table definition. &lt;/li&gt;&lt;/ul&gt;
&lt;p dtid=&quot;1125899906842682&quot;&gt;But since most DBMS's implement unique constraints as unique indexes, it doesn't really matter which you choose.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842683&quot;&gt;&lt;b dtid=&quot;1125899906842684&quot;&gt;How To #2: NHibernate&lt;/b&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842685&quot;&gt;Since I have the pleasure of learning the NHibernate ORM tool on my current project, I thought I'd also describe the same technique with a different tool. Basically you can either set the Unique attribute to true to obtain uniqueness in one column, or set the &lt;a href=&quot;http://blog.benday.com/archive/2006/04/02/4007.aspx&quot; dtid=&quot;1125899906842686&quot;&gt;unique-key attribute&lt;/a&gt; to obtain uniqueness among multiple columns. If you use NHibernate &lt;a href=&quot;http://www.hibernate.org/hib_docs/nhibernate/html/mapping-attributes.html&quot; dtid=&quot;1125899906842687&quot;&gt;mapping attributes&lt;/a&gt; you write:&lt;/p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842688&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal&quot; dtid=&quot;1125899906842689&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842690&quot;&gt;[&lt;span style=&quot;COLOR: rgb(43,145,175)&quot; dtid=&quot;1125899906842691&quot;&gt;Property&lt;/span&gt;(NotNull = &lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842692&quot;&gt;true&lt;/span&gt;, Length = 100, Unique = &lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842693&quot;&gt;true&lt;/span&gt;)]&lt;o:p dtid=&quot;1125899906842694&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal&quot; dtid=&quot;1125899906842695&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842696&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842697&quot;&gt; &lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842698&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842699&quot;&gt;string&lt;/span&gt; CountryName {&lt;o:p dtid=&quot;1125899906842700&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal&quot; dtid=&quot;1125899906842701&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842702&quot;&gt;&lt;span dtid=&quot;1125899906842703&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842704&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;/span&gt; { &lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842705&quot;&gt;return&lt;/span&gt; _strCountryName; }&lt;o:p dtid=&quot;1125899906842706&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal&quot; dtid=&quot;1125899906842707&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842708&quot;&gt;&lt;span dtid=&quot;1125899906842709&quot;&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842710&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&lt;/span&gt; { _strCountryName = &lt;span style=&quot;COLOR: blue&quot; dtid=&quot;1125899906842711&quot;&gt;value&lt;/span&gt;; }&lt;o:p dtid=&quot;1125899906842712&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal&quot; dtid=&quot;1125899906842713&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'&quot; dtid=&quot;1125899906842714&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 11pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'&quot; dtid=&quot;1125899906842715&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/span&gt;
&lt;p dtid=&quot;1125899906842718&quot;&gt;Which generates the following hbm:&lt;/p&gt;&lt;span class=&quot;m1&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #0000ff; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;t1&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #990000; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;class name&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;m1&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #0000ff; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;=&quot;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;Country&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;m1&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: #0000ff; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA&quot;&gt;&lt;br /&gt;&lt;span class=&quot;m1&quot;&gt;&lt;span style=&quot;COLOR: #0000ff; mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;id name&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;=&quot;&lt;/span&gt;&lt;b&gt;CountryId&lt;/b&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;generator&lt;/span&gt; &lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;=&quot;&lt;/span&gt;&lt;b&gt;sequence&lt;/b&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&quot; /&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;COLOR: #0000ff&quot;&gt;&lt;span class=&quot;m1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;m1&quot;&gt;&lt;span style=&quot;COLOR: #0000ff; mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;property&lt;/span&gt; &lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;=&quot;&lt;/span&gt;&lt;b&gt;CountryName&lt;/b&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt; length&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;=&quot;&lt;/span&gt;&lt;b&gt;100&lt;/b&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt; not-null&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;=&quot;&lt;/span&gt;&lt;b&gt;true&lt;/b&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt; unique&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;=&quot;&lt;/span&gt;&lt;b&gt;true&lt;/b&gt;&lt;span style=&quot;COLOR: #0000ff&quot;&gt;&lt;span class=&quot;m1&quot;&gt;&quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;t1&quot; style=&quot;COLOR: #990000&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;m1&quot; style=&quot;COLOR: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; 
&lt;p dtid=&quot;1125899906842786&quot;&gt;Which NHibernate turns into the following DDL:&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;table&lt;/span&gt; Country &lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;?xml namespace=&quot;&quot; ns=&quot;urn:schemas-microsoft-com:office:office&quot; prefix=&quot;o&quot; ?&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CountryId NUMBER&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;COLOR: gray&quot;&gt;,&lt;/span&gt;0&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;null,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CountryName NVARCHAR2&lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;100&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;&amp;lt;&lt;/span&gt;b&lt;span style=&quot;COLOR: gray&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;unique&lt;/span&gt;&lt;span style=&quot;COLOR: gray&quot;&gt;&amp;lt;/&lt;/span&gt;b&lt;span style=&quot;COLOR: gray&quot;&gt;&amp;gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;primary&lt;/span&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;key&lt;/span&gt; &lt;span style=&quot;COLOR: gray&quot;&gt;(&lt;/span&gt;CountryId&lt;span style=&quot;COLOR: gray&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;)&lt;/span&gt; 
&lt;p&gt;So quick quiz: was that a unique index or unique constraint it generated? If you answered who cares you're right. However if you answered a unique constraint you're also right.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842848&quot;&gt;&lt;b dtid=&quot;1125899906842849&quot;&gt;The Problem with ORM&lt;/b&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842850&quot;&gt;Obviously ignorance of the problem and shortsightedness are two causes for systems going into production without unique indexes, but I'd like to point out a third. While Object Relational Mapping (ORM) tools like NHibernate are extremely convenient for generating database schemas, modeling database tables with classes and generating DDL can lead developers to a false sense of purpose.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842851&quot;&gt;This can occur because ORM tools focus entirely on the world of objects and classes. In this world data's persistence is irrelevant. It exists for the purposes of a single operation, and consequently long term data persistence issues like data integrity are deemphasized. In fact, it would be easy to lose perspective of the fact that there is a database at all.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842852&quot;&gt;Don't get me wrong, the benefits you get like mandatory surrogate keys, DBMS neutrality, lazy loading, and minimal data access code are wonderful. Just don't forget that tags like NHibernate's &lt;i dtid=&quot;1125899906842853&quot;&gt;unique&lt;/i&gt; and &lt;i dtid=&quot;1125899906842854&quot;&gt;unique-key&lt;/i&gt; exist. And are very necessary.&lt;/p&gt;
&lt;p dtid=&quot;1125899906842855&quot;&gt;&lt;b dtid=&quot;1125899906842856&quot;&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p dtid=&quot;1125899906842857&quot;&gt;To sum it up don't allow the convenience of surrogate keys to lull you into a false sense of security regarding the importance of keys. It's a trap. And it will be a disastrous one if you aren't careful.&lt;/p&gt; 
</description>
        
          <category term="general" label="general"/>
        
          <category term="sql" label="sql"/>
        
      </item>
    
      <item>
        <title>Surrogate Keys - Data Modeling Mistake 2 of 10</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/surrogate_keys_data_modeling_mistake.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/surrogate_keys_data_modeling_mistake.html</guid>
        <pubDate>Thu, 16 Aug 2007 08:08:45 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming &lt;a href=&quot;http://www.iasahome.org/web/capitalarea/itarc2007&quot;&gt;IASA conference&lt;/a&gt; in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/08/in-case-youre-new-to-series-ive.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;The last post in this series &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/07/referential-integrity-data-modeling.html&quot;&gt;Referential Integrity&lt;/a&gt; was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.&lt;/p&gt;
&lt;p&gt;I intend to address this topic by way of a fairly ubiquitous example that should draw out all of the arguments. I'll investigate the options for primary keys in a Person table. I'll provide four possible options and explain why each of them is a bad choice. I'll then give four arguments against surrogate keys, which I will then shoot down. So without further ado:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Contender 1: Name and Location&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Of course you can't use &lt;i&gt;name&lt;/i&gt; as a primary key for a person, because two people can have the same name and primary keys must be unique. But all too often I've seen databases with multiple, sometime numerous, natural (or business-related) primary keys. These databases combine a field like name with enough other fields such that the likelihood of uniqueness is approaching certainty.&lt;/p&gt;
&lt;p&gt;In the case of person this would be equivalent to First and Last Name (wouldn't want to violate &lt;a href=&quot;http://en.wikipedia.org/wiki/First_normal_form&quot;&gt;first normal form&lt;/a&gt; by combining those into one field, but that's a whole other topic), zip code, and we ought to throw address line 1 in to be safe. This is known as either a compound, composite, or multicolumn index.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RsQ5nuB8egI/AAAAAAAAAJ0/1QmW1CiIq_w/s1600-h/1.+Compound+Natural+Keys.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5099264032624114178&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RsQ5nuB8egI/AAAAAAAAAJ0/1QmW1CiIq_w/s400/1.+Compound+Natural+Keys.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now our chances of uniqueness are close enough to certain to not warrant discussion, so let's jump right to space and performance. There are three major problems with this approach.&lt;/p&gt;
&lt;p&gt;Con 1: Primary key size. The primary key index for person becomes enormous. The database must now catalog four large (probably all varchar) fields. This increases the size of the index which &lt;a href=&quot;http://www.mssqlcity.com/Tips/tipInd.htm&quot;&gt;increases overhead&lt;/a&gt; for insert, delete and update operations and can even decreases read speed because of the &lt;a href=&quot;http://www.sql-server-performance.com/tips/composite_indexes_p1.aspx&quot;&gt;increased disk I/O&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Con 2: Foreign key size. If you have a child table like PhoneNumber then, as the diagram above shows, the foreign key becomes four columns. Those four columns take up a lot of space again. And now a common query like &quot;Get all phone numbers for a person&quot; involves a full table scan, or, if you throw an index on them you end up with another huge index. In fact, you most likely end up propagating huge indexes and vast amounts of data all over the place like some evil data-cancer.&lt;/p&gt;
&lt;p&gt;Con 3: Asthetics. It just isn't pretty. Having four column foreign keys all over the place increases the amount of code you need to write in stored procedures, middle tier, and presentation tier. Even intellisense won't help you with this one.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Contender 2: Social Security Number&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The most obvious choice for a natural key for a person object is social security number, right? Obviously it depends on what type of data person is, but regardless you'll probably face the following four problems with this primary key candidate:&lt;/p&gt;
&lt;p&gt;Con 4: Optionality. The social security administration specifies that U.S. citizens &lt;a href=&quot;http://ssa-custhelp.ssa.gov/cgi-bin/ssa.cfg/php/enduser/std_adp.php?p_faqid=78&quot;&gt;are not required to provide social security numbers&lt;/a&gt; in many circumstances. While employment is one of these circumstances, consumers of non-governmental services are definitely not. You can deny service if your consumer won't provide the number, but is your CEO prepared to turn away business based on a data modeling decision you make?&lt;/p&gt;
&lt;p&gt;Con 5: Applicability. Only U.S. citizens have a social security number. Your system might only cater to U.S. citizens now, but will it always?&lt;/p&gt;
&lt;p&gt;Con 6: Uniqueness. The social security administration &quot;&lt;a href=&quot;http://www.slate.com/id/2081843/&quot;&gt;is adamant&lt;/a&gt;&quot; that the numbers are not recycled, even after someone dies. But eventually the numbers will run out. If you visit the slate article cited above, it calculates this date as in the next century. But the math fails to include the fact that location information is encoded in the number which significantly limits the permutations. I don't know what the real number is, but the point is: you're gambling with how long until a conflict occurs. And even if the time argument fails to sway you, just think of who is assigning the numbers. How much do you trust a government office to not make an occasional mistake?&lt;/p&gt;
&lt;p&gt;Con 7: Privacy. Does your application use primary keys in the user interface tier to uniquely identify records? Does it pass primary keys between pages or use them to identify rows in a combo box? You certainly wouldn't store such a thing in a cookie or pass it across the wire unencrypted right? Social security information is sensitive information and privacy zealots care very much how you handle their data. Primary keys are necessarily are closer to end users and harder to hide than regular fields. It just isn't the type of data to take a chance on.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Contender 3: E-mail&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So e-mail is a pretty likely choice right? It's a relatively safe assumption that no two people share an e-mail (maybe). And anyone with a computer has one right? So there should be no uniqueness, privacy or optionality/applicability problems. But how about this:&lt;/p&gt;
&lt;p&gt;Con 8: Accidental Denormalization. Do you have more than one e-mail address? Doesn't everyone? Imagine what a pain it would be if Evite only allowed you one e-mail address per person (ok, well if you didn't know it does allow you to consolidate accounts for those of us with multiple e-mail addresses). Even if your system only stores one e-mail address per person now, just think what a pain it would be to change the database to allow N e-mail addresses per person. &lt;/p&gt;
&lt;p&gt;No. Wait. Really. Think about it...&lt;/p&gt;
&lt;p&gt;Yea&amp;nbsp;... yuck.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Contender 4: Username&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If your users log in with a username, that's a likely candidate for a primary key right? But what if they want to update their username (perhaps it was based on a last name that changed). This leads us to:&lt;/p&gt;
&lt;p&gt;Con 9: Cascading Updates. If you have a natural key that might change you'll need to implement some type of cascading updates (whether your DBMS supports it or you write code by hand). In other words, change the username in the person table and you have to change the username foreign key in all child records of the invoices, comments, sales, certifications, defects, or whatever other tables you track. It may not happen often, but when it does it sure will wreak havoc on your indexes. Imagine rebuilding even 10% of your indexes at once because of one operation. It's just unnecessary.&lt;/p&gt;
&lt;p&gt;Con 10: Varchar join speed. I left this to last because it applies to all of contenders thus far and is by far the most compelling argument against natural keys. Nine out of ten natural keys are varchar fields. Even an employee number as generated by another system may have a significant zero. It's a fact: joining across tables with varchars is always slower than joining across tables with integers. How much? According to Peter Zaitsev who runs a MySql performance blog it's &lt;a href=&quot;http://www.mysqlperformanceblog.com/2007/06/18/using-char-keys-for-joins-how-much-is-the-overhead/&quot;&gt;20% to 600% slower&lt;/a&gt;. And that's for one join. How many joins do you think comprise an average user interaction? Five? Ten? Twenty? It could very likely make a significant difference to your end user.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;And The Winner Is &lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So surrogate keys win right? Well, let's review and see if any of the con's of natural key's apply to surrogate keys:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Con 1: Primary key size - Surrogate keys generally don't have problems with index size since they're usually a single column of type int. That's about as small as it gets.&lt;/li&gt;
&lt;li&gt;Con 2: Foreign key size - They don't have foreign key or foreign index size problems either for the same reason as Con 1.&lt;/li&gt;
&lt;li&gt;Con 3: Asthetics - Well, it's an eye of the beholder type thing, but they certainly don't involve writing as much code as with compound natural keys.&lt;/li&gt;
&lt;li&gt;Con 4 &amp;amp; 5: Optionality &amp;amp; Applicability - Surrogate keys have no problems with people or things not wanting to or not being able to provide the data.&lt;/li&gt;
&lt;li&gt;Con 6: Uniqueness - They are 100% guaranteed to be unique. That's a relief.&lt;/li&gt;
&lt;li&gt;Con 7: Privacy - They have no privacy concerns should an unscrupulous person obtain them.&lt;/li&gt;
&lt;li&gt;Con 8: Accidental Denormalization&amp;nbsp;- You can't accidentally denormalize non-business data.&lt;/li&gt;
&lt;li&gt;Con 9: Cascading Updates - Surrogate keys don't change, so no worries about how to cascade them on update.&lt;/li&gt;
&lt;li&gt;Con 10: Varchar join speed - They're generally int's, so they're generally as fast to join over as you can get.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;For every natural key con I see a surrogate key pro. But not everyone agrees. Here are some arguments against them.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Disadvantage 1: Getting The Next Value&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Some have argued that getting the next value for a surrogate keys is a pain. Perhaps that's true in Oracle with its sequences, but generally it just takes a couple minutes research, or you can use ORM tools to hide the details for you.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Disadvantage 2: Users Don't Understand Them&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;One argument I uncovered is if users were to perform ad-hoc queries on the database they wouldn't be able to understand how to use surrogate keys. &lt;/p&gt;
&lt;p&gt;Bunk. Bunk, bunk, bunk. End users shouldn't be fiddling in databases any more than airline customers should be fiddling in airplane engines. And if they are savvy enough to try, then let them learn to perform joins like the pros do.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Disadvantage 3: Extra Joins&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Suppose you have users table with a social security number natural primary key, and a phone number child table with social security as a foreign key. &lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RsQ5n-B8ehI/AAAAAAAAAJ8/QWuvaB0l86g/s1600-h/2.+Social+Security+Number.jpg&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RsQ5n-B8ehI/AAAAAAAAAJ8/QWuvaB0l86g/s400/2.+Social+Security+Number.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If your user enters a social security number on a log in screen you could theoretically get their phone numbers without accessing the users table. In a surrogate key world you would have to look up the surrogate key in the person table before getting their phone numbers.&lt;/p&gt;
&lt;p&gt;While this is true, I have found that with most &lt;a href=&quot;http://en.wikipedia.org/wiki/Create%2C_read%2C_update_and_delete&quot;&gt;CRUD&lt;/a&gt; applications there are few times when this scenario comes up. The vast majority of queries involve already known surrogate keys. So while this argument may be true in some situations, it just isn't true enough of the time to be significant.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Disadvantage 4: Extra Indexes&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I find this to be the most persuasive argument against natural keys. If your person object would normally have a natural key on social security number, then in surrogate-world you should have a unique index on social security number in addition to your primary key index on the surrogate key. In other words, you now have two indexes instead of one. In fact, if you have N indexes per table in natural key world, you'll always have N + 1 indexes in surrogate key world.&lt;/p&gt;
&lt;p&gt;While the additional indexes do indeed add indexes, which increase database size, and slow insert and update performance, you could offset some of that expense by converting your old natural key, social security number for example, to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Index_%28database%29&quot;&gt;clustered index&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Or you could just relax in the knowledge that there are pro's and con's to every architectural decision and for surrogate keys the pro's outweigh the con's.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So now if some well meaning DBA argues to use natural keys on your next project you should have ten arguments against them, which will double as ten arguments for surrogate keys, and you should be prepared with rebuttals for four arguments against surrogate keys. Whew, that was a lot. But I assure you, if you use surrogate keys today it will definitely make your life easier in the long run.&lt;/p&gt; 
</description>
        
          <category term="general" label="general"/>
        
          <category term="sql" label="sql"/>
        
      </item>
    
      <item>
        <title>Sync Your Database to SharePoint Using SSIS</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/sync_your_database_to_sharepoint.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/sync_your_database_to_sharepoint.html</guid>
        <pubDate>Mon, 30 Jul 2007 18:47:01 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;Just a heads up that DevX just published an article of mine today. The article is entitled &lt;a href=&quot;http://www.devx.com/dotnet/Article/35070&quot;&gt;Sync Your Database to SharePoint Using SSIS&lt;/a&gt;. The article covers how to import and export SharePoint list items using Collaborative Application Markup Language (CAML), SharePoint's web services API, and &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL_Server_Integration_Services&quot;&gt;SQL Server Integration Services&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The latter half of the article is a fairly detailed how-to, but the former half covers what SharePoint lists are, what SSIS is, and why you would want to use them all together. I hope you find the article useful, and feel free to comment here if you have thoughts on the article.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Referential Integrity - Data Modeling Mistake 1 of 10</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/referential_integrity_data_modeling_mistake.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/referential_integrity_data_modeling_mistake.html</guid>
        <pubDate>Wed, 18 Jul 2007 19:02:03 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;In my mind data models are like the foundations of a house. Whether you use ORM or a more traditional modeling tool, they form the base of the entire rest of your project. Consequently, every decision you make (or don't make) regarding your data model during the design phase(s) of your project will significantly affect the duration of your project and the maintainability and performance of your application. &lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/07/referential-integrity-data-modeling.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;You could de-emphasize up-front planning, but every correction you make to the data model once code has been written on top of it will introduce significant delays to the project as developers refactor data access, business logic, and user interface tiers. That's why mistakes made during design are expensive, and it would behoove any architect (or project manager) to be well aware of the repercussions of data model decisions and minimize mistakes before construction begins.&lt;/p&gt;
&lt;p&gt;After years of working with or maintaining applications based on poorly designed data models, and after years of modeling my own databases from scratch I've seen and made a lot of mistakes. So, I've compiled ten of the most common ones and the arguments for and against them. &lt;/p&gt;
&lt;p&gt;I'll be speaking on this topic in the upcoming &lt;a href=&quot;http://www.iasahome.org/web/capitalarea/itarc2007&quot;&gt;IASA conference&lt;/a&gt; in October, and so I wanted to vet these ideas with the community. I know there are strong feelings on these topics, so please help me out by commenting if you feel I've missed something or am off base. &lt;/p&gt;
&lt;p&gt;I'll start with Mistake #1: Not Using Referential Integrity in this post. I'll give four common reasons for avoiding referential integrity and then rebuff them. I'll then cover the more controversial Mistake #2 Not Using Surrogate Keys in my next post.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Mistake #1 - Not using referential integrity&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I've heard a lot of excuses for not using referential integrity, but I've never been swayed by one of them. If you have a record with a foreign key field you should be 100% certain that it will &lt;i&gt;always&lt;/i&gt; refer to the primary key of an &lt;i&gt;existing&lt;/i&gt; record in &lt;i&gt;one and only one&lt;/i&gt; foreign table. The last thing you want to do is write large amounts of conditional logic because you aren't 100% certain that you aren't dealing with orphaned data. Nonetheless, here are some almost compelling arguments I've heard for not using it:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reason #1: Project Too Small&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If your project or database is only a few tables and a couple lines of code then you don't need referential integrity right? Wrong, numerous projects start small, get big, and have major problems because of it. It doesn't take much extra time to put in constraints. Avoid the urge to be lazy.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reason #2: Accidental Oversight&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Numerous applications I've seen forget a relationship or two. This is borne of writing and executing database creation statements by hand and is the reason that data modeling tools exist. When you visualize your database in a model it's hard to miss a relationship. So use a modeling tool and keep it in sync with your database, you won't regret it.&lt;/p&gt;
&lt;p&gt;Incidentally I like Microsoft Visio for data modeling because you can change your schema during development and Visio won't delete your data. This enables you to keep your data model in sync with the database for the entire lifetime of the database. There are other benefits too, if you're interested see my article on &lt;a href=&quot;http://blueink.biz/DataModelingVisio.aspx&quot;&gt;data modeling in Microsoft Visio&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reason #3: Maximize Insert Speed&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It's a fact: indexes and constraints slow down insert and update operations. If your application is heavy on writing and light on reading, then you could argue referential integrity isn't for you. This argument is often combined with the &quot;Only one application ever uses my database&quot; argument.&lt;/p&gt;
&lt;p&gt;There are two problems with this. One problem comes when either a well meaning DBA modifies data by hand and messes up the state of the database, or more realistically when there's a bug in the application that accidentally orphans data. Orphaned data may not affect your application, but a well designed solution should plan for the future. When that data warehouse project finally gets around to importing data from your database, what do they do with the orphaned data? Ignore it? Try to integrate it? Who knows? If you've been in this position, you'll know what I mean when I say the responsible architect's name (or their app) will be synonymous with a curse word.&lt;/p&gt;
&lt;p&gt;The second problem is that even if a database without referential integrity don't end up with orphaned data, a second application that might want to integrate can still never be 100% certain that foreign keys refer to existing records. It comes down to designing for the future.&lt;/p&gt;
&lt;p&gt;The answer to speed is to build your database with referential integrity, drop or disable your constraints and indexes before a bulk load, and re-enable them after the bulk load. It will increase the duration of your bulk load operation over not using constraints at all, but it will be much faster than leaving them enabled and checking them for each insert. So use referential integrity: the pros outweigh the cons.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reason #4: Mutually exclusive relationships&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Too often I've seen databases with a foreign key that relates to one of five tables based on the value of a char(1) field. The space conserving mindset that comes up with this implementation is admirable, but it produces far too many negative side effects.&lt;/p&gt;
&lt;p&gt;What happens when the char(1) field gets out of sync with the foreign key field? What happens when someone deletes the foreign record or changes its primary key? More orphaned data happens.&lt;/p&gt;
&lt;p&gt;The solution is to use five fields that each refer to a single table. You may have more nullable fields that take up more space in the database, but it's worth it in the long run.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rp6YOlrrHgI/AAAAAAAAAI0/Nxao5WbYlFM/s1600-h/Mutually+Exclusive+Problem.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5088672005376122370&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rp6YOlrrHgI/AAAAAAAAAI0/Nxao5WbYlFM/s400/Mutually+Exclusive+Problem.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Well, hopefully I've convinced you to avoid the urge to be a lazy data modeler, design for the future, use a data modeling tool, and drop constraints during bulk load operations. In short, always use referential integrity. But if not, hopefully you'll at least understand when people curse your name several years from now. :)&lt;/p&gt; 
</description>
        
          <category term="general" label="general"/>
        
          <category term="sql" label="sql"/>
        
      </item>
    
      <item>
        <title>An Entity Relationship Diagram Example</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/an_entity_relationship_diagram_example.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/an_entity_relationship_diagram_example.html</guid>
        <pubDate>Thu, 07 Jun 2007 00:38:24 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;It seems like a dying art, but I still strongly feel that Entity Relationship Diagrams (ERD) should be the starting point of all software development projects. Since they are for me anyway, I wanted a place to refer colleagues to for how to read these diagrams, and an Entity Relationship Diagram Example seemed like a great place to start.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/06/entity-relationship-diagram-example.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;The Example: A Resource Management Application&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Consider that we're writing a resource management application. The first step to creating an ERD is always to identify the nouns (entities). In this case let's start with:&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;Company&lt;/li&gt;
&lt;li&gt;Employee &lt;/li&gt;
&lt;li&gt;Project; and &lt;/li&gt;
&lt;li&gt;Technology Project (which are a specific type of Project that perhaps require special fields like &quot;number of entities&quot;)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here's the Example Entity Relationship Diagram I'll decipher piece by piece in this article (click to enlarge):&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp3.blogger.com/_gez10dNhuPk/Rmdg-XjZyjI/AAAAAAAAAH0/sn94SwOFWO4/s1600-h/01-ErdExample.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5073130129846815282&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/Rmdg-XjZyjI/AAAAAAAAAH0/sn94SwOFWO4/s400/01-ErdExample.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(note that I'm now using singular names since my somewhat controversial decision to switch to &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/03/entity-naming-conventions.html&quot; target=&quot;&quot;&gt;naming entities in the singular&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;To read the notations of an Entity Relationship Diagram:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;An Entity Relationship Diagram conveys a lot of information with a very concise notation. The important part to keep in mind is to limit what you're reading using the following technique:&lt;/p&gt;
&lt;p&gt;
&lt;ol&gt;
&lt;li&gt;Choose two entities (e.g. Company and Employee) &lt;/li&gt;
&lt;li&gt;Pick one that you're interested in (e.g. how &lt;b&gt;a single Company&lt;/b&gt; relates to employees)&lt;/li&gt;
&lt;li&gt;Read the notation on the second entity (e.g. the crow's feet with the O above it next to the Employee entity). &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The set of symbols consist of Crow's feet (which &lt;a href=&quot;http://en.wikipedia.org/wiki/Entity-relationship_model#Crow.27s_Feet&quot; target=&quot;_blank&quot;&gt;Wikipedia&lt;/a&gt; describes as looking like the forward digits of a bird's claw), O, and dash, but they can be combined in four distinct combinations. Here are the four combinations:&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;Zero through Many (crow's feet, O)&lt;/li&gt;
&lt;li&gt;One through Many (crow's feet, dash)&lt;/li&gt;
&lt;li&gt;One and Only One (dash, dash)&lt;/li&gt;
&lt;li&gt;Zero or One (dash, O)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Zero through Many&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RmeNA3jZyqI/AAAAAAAAAIs/2qnhtwSfqDc/s1600-h/02-ZeroThroughMany.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5073178551308110498&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RmeNA3jZyqI/AAAAAAAAAIs/2qnhtwSfqDc/s400/02-ZeroThroughMany.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If, as in the diagram above, the notation closest to the second entity is a crow's feet with an O next to it, then the first entity can have zero, one, or many of the second entity. Consequently the diagram above would read: &quot;A company can have zero, one, or many employees&quot;.&lt;/p&gt;
&lt;p&gt;This is the most common relationship type, and consequently many people ignore the O. While you can consider the O optional, I consider it a best practice to be explicit to differentiate it from the less common one through many relationship.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;One through Many&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp0.blogger.com/_gez10dNhuPk/Rmdg-njZylI/AAAAAAAAAIE/xLc99gOFKvQ/s1600-h/03-OneThroughMany.gif&quot;&gt;&lt;img id=&quot;Img2&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/Rmdg-njZylI/AAAAAAAAAIE/xLc99gOFKvQ/s400/03-OneThroughMany.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If, as the next diagram shows, the notation closest to the second entity is a crow's feet with a dash, then the first entity can have one through many of the second entity. More specifically it may not contain zero of the second entity. The example above would thus read (read bottom to top): &quot;A Project can have one through many Employees working on it.&quot;&lt;/p&gt;
&lt;p&gt;This is an interesting combination because it can't (and for various reasons probably shouldn't if it could) be enforced by a database. Thus, you will only see these in logical, but not a physical, data models. It is still useful to distinguish, but your application will need to enforce the relationship in business rules.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;One and Only One (onne)&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rmdg-3jZymI/AAAAAAAAAIM/v6ISuqqp3R8/s1600-h/04-OneAndOnlyOne.gif&quot;&gt;&lt;img id=&quot;Img3&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rmdg-3jZymI/AAAAAAAAAIM/v6ISuqqp3R8/s400/04-OneAndOnlyOne.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If the notation closest to the second entity contains two dashes it indicates that the first entity can have one and only one of the second. More specifically it cannot have zero, and it cannot have more than one. The example would thus read: &quot;An Employee can have one and only one Company.&quot;&lt;/p&gt;
&lt;p&gt;This combination is the most common after zero through many, and so frequently people consider the second dash optional. In fact, some ignore both dashes, but I would highly recommend at least using one for clarity so as not to confuse the notation with &quot;I'll fill in the relationship details later&quot;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Zero or One&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rmdg-3jZynI/AAAAAAAAAIU/e3XGZU-69Uk/s1600-h/05-ZeroOrOne.gif&quot;&gt;&lt;img id=&quot;Img4&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rmdg-3jZynI/AAAAAAAAAIU/e3XGZU-69Uk/s400/05-ZeroOrOne.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A zero or one relationship is indicated by a dash and an O. It indicates that the first entity can have zero or one of the second, but not more than one. The relationship in the example above would thus read: &quot;A Project can have zero or one Technology Project.&quot;&lt;/p&gt;
&lt;p&gt;The zero or one relationship is quite common and is frequently abbreviated with just an O (however it is most commonly seen in a many-to-many relationship rather than the one-to-one above, more on this later).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Relationship Types&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Having examined the four types of notation, the discussion wouldn't be complete without a quick overview of the three relationship types. These are:&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;One to Many&lt;/li&gt;
&lt;li&gt;Many to Many&lt;/li&gt;
&lt;li&gt;One to One&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;One-to-Many&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A one-to-many (1N) is by far the most common relationship type. It consists of either a &lt;i&gt;one through many&lt;/i&gt; or a &lt;i&gt;zero through many&lt;/i&gt; notation on one side of a relationship and a &lt;i&gt;one and only one&lt;/i&gt; or &lt;i&gt;zero or one&lt;/i&gt; notation on the other. The relationship between Company and Employee in the example is a one-to-many relationship.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Many-to-Many&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The next most common relationship is a many-to-many (NM). It consists of a zero through many or one through many on both sides of a relationship. This construct only exists in logical data models because databases can't implement the relationship directly. Physical data models implement a many-to-many relationship by using an associative (or link or resolving) table via two one-to-many relationships.&lt;/p&gt;
&lt;p&gt;The relationship between Employee and Project in the example is a many to many relationship. It would exist in logical and physical data models as follows:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp3.blogger.com/_gez10dNhuPk/RmdhGXjZyoI/AAAAAAAAAIc/MheEUX8GMDc/s1600-h/06-Many-To-Many.gif&quot;&gt;&lt;img id=&quot;Img5&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/RmdhGXjZyoI/AAAAAAAAAIc/MheEUX8GMDc/s400/06-Many-To-Many.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;One-to-One&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Probably the least common and most misunderstood relationship is the one-to-one. It consists of a one and only one notation on one side of a relationship and a zero or one on the other. It warrants a discussion unto itself, but for now the Project to Technology Project relationship in the example is a one to one. Because these relationships are easy to mistake for traditional one-to-many relationships, I have taken to drawing a red dashed line around them. The red dashed line is not standard at all (although a colleague, Steve Dempsey uses a similar notation), but in my experience it can help eliminate confusion.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rmdms3jZypI/AAAAAAAAAIk/XLcplhldx3M/s1600-h/07-One-To-One.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5073136426268871314&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rmdms3jZypI/AAAAAAAAAIk/XLcplhldx3M/s400/07-One-To-One.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I hope you've found this a useful example for deciphering and verifying entity relationship diagrams. As always please add any comments, disagreements, thoughts or related resources.&lt;/p&gt; 
</description>
        
          <category term="general" label="general"/>
        
          <category term="sql" label="sql"/>
        
      </item>
    
      <item>
        <title>Export Visio Database Table Names to Excel</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/export_visio_database_table_names.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/export_visio_database_table_names.html</guid>
        <pubDate>Thu, 10 May 2007 18:23:07 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/05/export-visio-database-table-names-to.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        diggIframe.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;Regardless, it turns out to be non-trivial to perform this export, particularly if you are unable to generate to a database to retrieve the table names. The trick is to use the reporting feature of Visio, but there are many reports and report options, and you will need one that is table-based to get the data into Excel easily.&lt;/p&gt;
&lt;p&gt;Note: If you are unfamiliar with the capabilities of Microsoft Visio as a data modeling tool you may wish to take a look at my &lt;a href=&quot;http://www.blueink.biz/DataModelingVisio.aspx&quot; target=&quot;_blank&quot;&gt;Data Modeling in Microsoft Visio Tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Export Procedure&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;1. This may seem a little unusual, but if you don't have any comments in any of your tables (which really shouldn't be the case), you will need to add comments for at least one of your tables. Without this step Visio will not display tables in a grid format in the report.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RkOVRcasq2I/AAAAAAAAAG8/WOaiqX7aBpw/s1600-h/00+Table+Notes.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5063054533013056354&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RkOVRcasq2I/AAAAAAAAAG8/WOaiqX7aBpw/s400/00+Table+Notes.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. Now select the somewhat obscure &quot;Report&quot; item off of the &quot;Database&quot; menu.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp3.blogger.com/_gez10dNhuPk/RkOVRsasq3I/AAAAAAAAAHE/JQA2hQSj84c/s1600-h/01+Report+Menu.jpg&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/RkOVRsasq3I/AAAAAAAAAHE/JQA2hQSj84c/s400/01+Report+Menu.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3. Only the &quot;Table Report&quot; provides the ability to layout database tables in a grid. Select it and click Finish.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp3.blogger.com/_gez10dNhuPk/RkOVRsasq4I/AAAAAAAAAHM/l3hew4Itvdw/s1600-h/02+Table+Report.jpg&quot;&gt;&lt;img id=&quot;Img2&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/RkOVRsasq4I/AAAAAAAAAHM/l3hew4Itvdw/s400/02+Table+Report.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4. Under &quot;Predefined logical/physical reports&quot; Click the button labeled &quot;Default To: General Report&quot; and change it to &quot;Default To: Database Report.&quot; This will remove tables formatted per page from the end of the report.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVR8asq5I/AAAAAAAAAHU/qvlawWZhedQ/s1600-h/03+Database+Report+Type.jpg&quot;&gt;&lt;img id=&quot;Img3&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVR8asq5I/AAAAAAAAAHU/qvlawWZhedQ/s400/03+Database+Report+Type.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;5. Under the &quot;Attributes&quot; tab select &quot;Deselect All&quot; then select the &quot;Table stats summary&quot; option.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVR8asq6I/AAAAAAAAAHc/4435zlyq1Wk/s1600-h/04+Table+Stats+Summary.jpg&quot;&gt;&lt;img id=&quot;Img4&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVR8asq6I/AAAAAAAAAHc/4435zlyq1Wk/s400/04+Table+Stats+Summary.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;6. Click &quot;Export to RTF,&quot; save the file somewhere, and open it with Microsoft Word.&lt;/p&gt;
&lt;p&gt;7. (optional) If you have any new lines in the notes field you may have to replace them with spaces. Just do a search and replace for &quot;^l&quot; and replace with &quot; &quot;.&lt;/p&gt;
&lt;p&gt;8. Now you're ready to copy and paste.&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVY8asq7I/AAAAAAAAAHk/0M_u7Bh6aIE/s1600-h/05+Word+Copy.jpg&quot;&gt;&lt;img id=&quot;Img5&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVY8asq7I/AAAAAAAAAHk/0M_u7Bh6aIE/s400/05+Word+Copy.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVY8asq8I/AAAAAAAAAHs/mJetOKvLlUE/s1600-h/06+Excel+Paste.jpg&quot;&gt;&lt;img id=&quot;Img6&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RkOVY8asq8I/AAAAAAAAAHs/mJetOKvLlUE/s400/06+Excel+Paste.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And you're done! Hopefully this tutorial will make life easier for you next time you need to export table names from Visio to Microsoft Excel.&lt;/p&gt; 
</description>
        
          <category term="general" label="general"/>
        
          <category term="sql" label="sql"/>
        
      </item>
    
      <item>
        <title>CAML: Nested Too Deep</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/caml_nested_too_deep.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/caml_nested_too_deep.html</guid>
        <pubDate>Fri, 04 May 2007 13:04:38 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I discovered an interesting error recently while working with Microsoft's Collaborative Application Markup Language (CAML) that, surprisingly, had received no ink. Partly what surprises me about this is that the error may require you to rewrite large sections of your code if you haven't previously considered this SharePoint limitation. I'll start with some context, but first of all the error is: &lt;/p&gt;
&lt;p&gt;&quot;Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries,&quot; &lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/05/caml-nested-too-deep.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        
        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(redditIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;So let's back up and describe what CAML is for everyone who isn't yet experiencing this problem.&lt;/p&gt;
&lt;p&gt;CAML is an XML based query language that is similar to, and serves many of the same purposes as SQL and DDL. However, CAML is used primarily to interact with SharePoint lists. You can retrieve data using something like:&lt;/p&gt;&lt;span style=&quot;FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes&quot;&gt;&amp;lt;Where&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name='Title'/&amp;gt;&amp;lt;Value Type='Text'&amp;gt;hello&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;/Where&amp;gt;&lt;/span&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Which is equilivant to WHERE Title = &quot;hello&quot; in a SQL statement. At this point I'm sure you're asking why exchange 80 characters for 21? I suppose the answer is related to how CAML is primarily used in web services requests. Regardless, the nested too deeply error occurs when you try to insert large amounts of data into a list.&lt;/p&gt;
&lt;p&gt;The insert syntax is actually all batch based, so if you have 100 list items to insert into a list, you build them all into one big CAML statement and then send it across the wire with a call to &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/lists.lists.updatelistitems.aspx&quot; target=&quot;_blank&quot;&gt;Lists.UpdateListItems()&lt;/a&gt;. Your CAML statement will look something like the following:&lt;/p&gt;
&lt;div style=&quot;FONT-FAMILY: 'Courier New'&quot;&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Batch&lt;/span&gt; OnError=&quot;Continue&quot;&amp;gt;&lt;br /&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Method&lt;/span&gt; ID=&quot;1&quot; Cmd=&quot;New&quot;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt; Name=&quot;Title&quot;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;/span&gt;Hello&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt; Name=&quot;Document&quot;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;5&amp;lt;/&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Method&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Method&lt;/span&gt; ID=&quot;2&quot; Cmd=&quot;New&quot;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt; Name=&quot;Title&quot; &lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;/span&gt;World&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt; Name=&quot;Document&quot;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;5&amp;lt;/&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Field&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Method&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;COLOR: maroon&quot;&gt;Batch&lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;&amp;gt;&lt;?xml namespace=&quot;&quot; ns=&quot;urn:schemas-microsoft-com:office:office&quot;        prefix=&quot;o&quot; ?&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;The problem comes when you want to insert something like 19,642 list items into a list. SharePoint complains with &quot;Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries,&quot; and suddenly you're stuck with an enormous CAML statement that you need to break up into smaller batches. How small? Well, for me 300 worked and 500 didn't, so I set my batch size to 300.&lt;/p&gt;
&lt;p&gt;This means that if you are currently experiencing this problem, then have fun rewriting your code to use smaller batches. And, if you're lucky enough to be reading this before you experience the error, then prepare yourself now for this possibility. &lt;/p&gt;
&lt;p&gt;Or, if performance isn't an issue and you don't want to or can't rewrite the code that built your CAML then feel free to use this code to batch up CAML batches into smaller batches.&lt;/p&gt;
&lt;div class=&quot;LeeCodeCAML&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;summary&amp;gt;&lt;?xml namespace=&quot;&quot; ns=&quot;urn:schemas-microsoft-com:office:office&quot;
                            prefix=&quot;o&quot; ?&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; Breaks a larg CAML query into smaller batches to avoid the error &quot;Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.&quot;&lt;?xml namespace=&quot;&quot; ns=&quot;urn:schemas-microsoft-com:office:office&quot;
                        prefix=&quot;o&quot; ?&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;param name=&quot;listService&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;The SharePoint list service to execute the CAML against.&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;param name=&quot;strListName&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;The name of the list to execute the CAML against.&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;param name=&quot;elementLargeBatch&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;The CAML batch list of commands to be broken up.&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;param name=&quot;intBatchSize&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;The size of batches to use.&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;If unsure use 300, it seems to work fairly well.&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;The results of all batched queries.&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&amp;lt;/returns&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt; &lt;span style=&quot;COLOR: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlNode&lt;/span&gt; ExecuteLargeQuery(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Lists&lt;/span&gt; listService, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;string&lt;/span&gt; strListName, &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlElement&lt;/span&gt; elementLargeBatch,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intBatchSize&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// calculate useful information&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intMethodCount = elementLargeBatch.ChildNodes.Count;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intBatchCount = (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt;)&lt;span style=&quot;COLOR: #2b91af&quot;&gt;Math&lt;/span&gt;.Ceiling((&lt;span style=&quot;COLOR: blue&quot;&gt;double&lt;/span&gt;)intMethodCount / (&lt;span style=&quot;COLOR: blue&quot;&gt;double&lt;/span&gt;)intBatchSize);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// prepare xml documents for batches and results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlDocument&lt;/span&gt; xmlDocBatch = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlDocument&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlDocument&lt;/span&gt; xmlDocResults = &lt;span style=&quot;COLOR: blue&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlDocument&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlElement&lt;/span&gt; elementResults = xmlDocResults.CreateElement(&lt;span style=&quot;COLOR: #a31515&quot;&gt;&quot;Results&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// for each batch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intCurrentBatch = 0; intCurrentBatch &amp;lt; intBatchCount; intCurrentBatch++) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intMethodStart = intCurrentBatch * intBatchSize;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intMethodEnd = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;Math&lt;/span&gt;.Min(intMethodStart + intBatchSize - 1, intMethodCount - 1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlElement&lt;/span&gt; elementSmallBatch = &lt;span style=&quot;COLOR: #2b91af&quot;&gt;ListHelper&lt;/span&gt;.CreateBatch(xmlDocBatch);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// for each method in the batch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;COLOR: blue&quot;&gt;int&lt;/span&gt; intCurrentMethod = intMethodStart; intCurrentMethod &amp;lt;= intMethodEnd; intCurrentMethod++) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlElement&lt;/span&gt; element = (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlElement&lt;/span&gt;)elementLargeBatch.ChildNodes[intCurrentMethod];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;elementSmallBatch.AppendChild(xmlDocBatch.ImportNode(element, &lt;span style=&quot;COLOR: blue&quot;&gt;true&lt;/span&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// execute the batch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlNode&lt;/span&gt; nodeBatchResult = listService.UpdateListItems(strListName, elementSmallBatch);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// add the results of the batch into the results xml document&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;COLOR: #2b91af&quot;&gt;XmlElement&lt;/span&gt; elementResult &lt;span style=&quot;COLOR: blue&quot;&gt;in&lt;/span&gt; nodeBatchResult.ChildNodes)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;elementResults.AppendChild(xmlDocResults.ImportNode(elementResult, &lt;span style=&quot;COLOR: blue&quot;&gt;true&lt;/span&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: green&quot;&gt;// clean up&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;xmlDocBatch.RemoveAll();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;COLOR: blue&quot;&gt;return&lt;/span&gt; elementResults;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;b&gt;Useful MSDN References&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Incidentally, these MSDN references might be useful if you're interested in more info:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms426449.aspx&quot; target=&quot;_blank&quot;&gt;Introduction to Collaborative Application Markup Language (CAML)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms467521.aspx&quot; target=&quot;_blank&quot;&gt;CAML Reference: Query Schema&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms437562.aspx&quot; target=&quot;_blank&quot;&gt;CAML Reference: Batch Element&lt;/a&gt;&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>C# 3.0: The Sweet and Sour of Syntactic Sugar</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/c_3_0_the_sweet.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/c_3_0_the_sweet.html</guid>
        <pubDate>Wed, 25 Apr 2007 13:51:53 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;I've just started reading the blog of &lt;a href=&quot;http://weblogs.asp.net/scottgu/&quot;&gt;Scott Guthrie&lt;/a&gt; who is a general manager at Microsoft and is currently writing about the new C# 3.0 (code named Orcas). The post I felt strongly about describes &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2007/03/08/new-c-orcas-language-features-automatic-properties-object-initializers-and-collection-initializers.aspx&quot;&gt;three new language features&lt;/a&gt; including: &lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;Automatic Properties&lt;/li&gt;
&lt;li&gt;Object Initializers, and &lt;/li&gt;
&lt;li&gt;Collection Initializers&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--.LeeCodeSimple {overflow: auto; white-space: nowrap; background: #ffffcc; color: #000000; border: 1px solid #999999; width: 100%; padding-bottom: 16px; }--&gt;&lt;/style&gt;

&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/04/c-30-sweet-and-sour-of-syntactic-sugar.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        
        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(redditIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;All three features are purely syntactic sugar: they add nothing of real value to the language (unlike generics in C# 2.0 for example). One features is wonderful, while two are terrible.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;The Sweetest Syntactic Sugar Ever&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Automatic properties are fabulous. I've always grumbled about the number of lines required to create simple properties. Anything that can turn: &lt;/p&gt;
&lt;div class=&quot;LeeCodeSimple&quot;&gt;&lt;font color=&quot;blue&quot;&gt;public class&lt;/font&gt; Person {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=&quot;blue&quot;&gt;private string&lt;/font&gt; _firstName;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=&quot;blue&quot;&gt;public string&lt;/font&gt; FirstName {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=&quot;blue&quot;&gt;get&lt;/font&gt; { &lt;font color=&quot;blue&quot;&gt;return&lt;/font&gt; _firstName; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=&quot;blue&quot;&gt;set&lt;/font&gt; { _firstName = &lt;font color=&quot;blue&quot;&gt;value&lt;/font&gt;; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
&lt;p&gt;Into:&lt;/p&gt;
&lt;div class=&quot;LeeCodeSimple&quot;&gt;&lt;font color=&quot;blue&quot;&gt;public class&lt;/font&gt; Person {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=&quot;blue&quot;&gt;public string&lt;/font&gt; FirstName { &lt;font color=&quot;blue&quot;&gt;get&lt;/font&gt;; &lt;font color=&quot;blue&quot;&gt;set&lt;/font&gt;; }&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;Gets my vote.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Sickeningly Sweet&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Perhaps I'm a purest, but with more language conveniences comes: a steeper learning curve because of a larger language, and decreased readability because of the numerous ways of doing the same thing. Picture reading this in someone else's code:&lt;/p&gt;
&lt;div class=&quot;LeeCodeSimple&quot;&gt;Person p = &lt;font color=&quot;blue&quot;&gt;new&lt;/font&gt; Person(&lt;font color=&quot;gray&quot;&gt;&quot;Lee&quot;&lt;/font&gt;, &lt;font color=&quot;gray&quot;&gt;&quot;Richardson&quot;&lt;/font&gt;) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Phone = &lt;font color=&quot;gray&quot;&gt;&quot;111-111-1111&quot;&lt;/font&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Age = &lt;font color=&quot;maroon&quot;&gt;29&lt;/font&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Company = &lt;font color=&quot;blue&quot;&gt;new&lt;/font&gt; Company(&lt;font color=&quot;gray&quot;&gt;&quot;Near Infinity&quot;&lt;/font&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Phone = &lt;font color=&quot;gray&quot;&gt;&quot;222-222-2222&quot;&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;} &lt;/div&gt;
&lt;p&gt;Who would write this crap? &lt;i&gt;Everyone else&lt;/i&gt;, now that Microsoft lets them. I vote for the verbose, the readable, the single approach:&lt;/p&gt;
&lt;div class=&quot;LeeCodeSimple&quot;&gt;Company company = &lt;font color=&quot;blue&quot;&gt;new&lt;/font&gt; Company(&lt;font color=&quot;gray&quot;&gt;&quot;Near Infinity&quot;&lt;/font&gt;);&lt;br /&gt;company.Phone = &lt;font color=&quot;gray&quot;&gt;&quot;222-222-2222&quot;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;Person person = &lt;font color=&quot;blue&quot;&gt;new&lt;/font&gt; Person(&lt;font color=&quot;gray&quot;&gt;&quot;Lee&quot;&lt;/font&gt;, &lt;font color=&quot;gray&quot;&gt;&quot;Richardson&quot;&lt;/font&gt;);&lt;br /&gt;person.Phone = &lt;font color=&quot;gray&quot;&gt;&quot;111-111-1111&quot;&lt;/font&gt;;&lt;br /&gt;person.Age = &lt;font color=&quot;maroon&quot;&gt;29&lt;/font&gt;;&lt;br /&gt;person.Company = company;&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;Hmmm, and by the way did you count the number of lines?&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So do the differences between my thoughts on automatic properties contradict with my thoughts on object initializers and collection initializers? They don't. Basically a little sugar is good, but too much ruins the dish.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Parameter passing in C#</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/parameter_passing_in_c.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/parameter_passing_in_c.html</guid>
        <pubDate>Mon, 23 Apr 2007 17:34:18 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;The topic of parameter passing in C# keeps coming up, and so I thought this post might be useful. It's been my most popular post on my &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/01/parameter-passing-in-c.html&quot;&gt;rapid application development blog&lt;/a&gt;, so I thought I'd repost here. Please kick the post if you like it.&lt;/p&gt;
&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/01/parameter-passing-in-c.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        
        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/?url=' + currentPageUrl);
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(redditIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;So there I was, merrily browsing the Internet when I came across this fantastic site on topics such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Implementing a singleton pattern in C#, &lt;/li&gt;
&lt;li&gt;Type initializers, &lt;/li&gt;
&lt;li&gt;Static constructors, &lt;/li&gt;
&lt;li&gt;Delegates and events, &lt;/li&gt;
&lt;li&gt;And as my title suggests: Parameter passing in C#. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In short, all those things you rarely need to know to get your job done, but that separate mediocre developers from good ones. The site is by Jon Skeet and the articles are informative, well researched, well explained, well written. Here's the C# part of his site:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.yoda.arachsys.com/csharp/&quot;&gt;http://www.yoda.arachsys.com/csharp/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The article that caught my attention made sense to me, but being a very visual person I couldn't help but think that some pictures could really help illustrate the points. So without further ado, I illustrated the article. You probably don't need to read the article to understand this post - but you should:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.yoda.arachsys.com/csharp/parameters.html&quot;&gt;http://www.yoda.arachsys.com/csharp/parameters.html&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note: you can click the images to get a clearer view. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Value Types&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Notice that the values live inside the box which will not be the case for reference types. Also, the assignment operation copies the value inside of the box, this is important to compare with reference types.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RbzGkOmHxNI/AAAAAAAAACE/7pfJ9OEqJh8/s1600-h/1+Value+Types.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025109609934210258&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RbzGkOmHxNI/AAAAAAAAACE/7pfJ9OEqJh8/s400/1+Value+Types.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Quiz: What is the result of the WriteLine statement?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Answer: 5&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Reference Types&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Variables that hold reference types actually hold a reference to a location in memory (on the heap). So assignment operations copy &lt;em&gt;the address&lt;/em&gt;. Notice this is still consistent with diagram #1, the copy operation copies the value inside of the box.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp3.blogger.com/_gez10dNhuPk/RbzGwumHxOI/AAAAAAAAACM/ZaqW-Krmo-U/s1600-h/2+Reference+Types.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025109824682575074&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/RbzGwumHxOI/AAAAAAAAACM/ZaqW-Krmo-U/s400/2+Reference+Types.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Quiz: What is the result of the WriteLine statement? &lt;/p&gt;
&lt;p&gt;Answer: hello world &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Immutable Reference Types&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Immutable reference types like strings behave just like regular reference types except they don't provide a way to change their value.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp2.blogger.com/_gez10dNhuPk/Rb4IV-mHxVI/AAAAAAAAADk/viWcrNAGkCA/s1600-h/3+Immutable+Reference+Types.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025463407865218386&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/Rb4IV-mHxVI/AAAAAAAAADk/viWcrNAGkCA/s400/3+Immutable+Reference+Types.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href=&quot;http://bp0.blogger.com/_gez10dNhuPk/Rbzmr-mHxUI/AAAAAAAAADY/uwDUi1OgX8Q/s1600-h/3+Immutable+Reference+Types.gif&quot;&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Quiz: What is the result of the WriteLine statement? &lt;/p&gt;
&lt;p&gt;Answer: hello &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4. Value Types Passed by Value&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Passing a variable to a function by value is equivilant to instantiating a new variable and assigning it to the first (well, ignoring scope issues and such). Notice that the diagram below is nearly identical to diagram #1. &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp2.blogger.com/_gez10dNhuPk/Rbv93umHxJI/AAAAAAAAABE/4RPheK-Zzuc/s1600-h/4+Value+Types+Passed+by+Value.gif&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RbzHxOmHxQI/AAAAAAAAACc/mfGQFJOWdeo/s1600-h/4+Value+Types+Passed+by+Value.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025110932784137474&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RbzHxOmHxQI/AAAAAAAAACc/mfGQFJOWdeo/s400/4+Value+Types+Passed+by+Value.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Quiz: What is the result of the WriteLine statement? &lt;/p&gt;
&lt;p&gt;Answer: 5, same as #1 &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5. Reference Types Passed by Value&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In #4 I said passing a variable to a function by value is equivilant to instantiating a new variable and assigning it to the first. Is that still true of reference types? Yup. And did you notice there's an implicit assignment statement when passing by value? As you'll see shortly there won't be when passing by reference.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp0.blogger.com/_gez10dNhuPk/Rbv-BOmHxKI/AAAAAAAAABM/xNHmcXmfgSo/s1600-h/5+Reference+Types+Passed+by+Value.gif&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RbzIGOmHxRI/AAAAAAAAACk/3yW5hyQgwfI/s1600-h/5+Reference+Types+Passed+by+Value.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025111293561390354&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RbzIGOmHxRI/AAAAAAAAACk/3yW5hyQgwfI/s400/5+Reference+Types+Passed+by+Value.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Quiz: What is the result of the WriteLine statement? &lt;/p&gt;
&lt;p&gt;Answer: hello world&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6. Value Types Passed by Reference&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Passing by reference doesn't involve an implicity copy, instead it instantiates the inner variable to the address in memory of the outer variable. Then all references to the inner variable are implicitly dereferenced for you and voila, magically you're changing the value of the outer variable.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp2.blogger.com/_gez10dNhuPk/Rbv-LumHxLI/AAAAAAAAABU/WjyqIMFJHE4/s1600-h/6+Value+Types+Passed+by+Reference.gif&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://bp3.blogger.com/_gez10dNhuPk/RbzIWumHxSI/AAAAAAAAACs/1KCNwRMmquk/s1600-h/6+Value+Types+Passed+by+Reference.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025111577029231906&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/RbzIWumHxSI/AAAAAAAAACs/1KCNwRMmquk/s400/6+Value+Types+Passed+by+Reference.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Quiz: What is the result of the WriteLine statement? &lt;/p&gt;
&lt;p&gt;Answer: 10, and notice how different the diagram and results are than #1 and #4. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;7. Reference Types Passed by Reference&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Really this is no different than value types passed by reference (#6), except calling sb.Append() from an inner variable is dereferenced once to get to the outer variable and again because the outer variable is itself a pointer. &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp2.blogger.com/_gez10dNhuPk/Rbv-aumHxMI/AAAAAAAAABc/twQ3_G6QQRE/s1600-h/7+Reference+Types+Passed+by+Reference.gif&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RbzIj-mHxTI/AAAAAAAAAC0/gs1v9ClKQVY/s1600-h/7+Reference+Types+Passed+by+Reference.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5025111804662498610&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RbzIj-mHxTI/AAAAAAAAAC0/gs1v9ClKQVY/s400/7+Reference+Types+Passed+by+Reference.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By the way, when you get to the section in Jon's article called:&lt;/p&gt;
&lt;p&gt;&quot;Sidenote: what is the difference between passing a value object by reference and a reference object by value?&quot;&lt;/p&gt;
&lt;p&gt;Please read it carefully, it's an extremely good point. It can be sumed up by comparing the final assignment statement above (Reference Types Passed by Reference) to the final assignment statement in in diagram #5 (Reference Types Passed by Value). It's a subtle, but important difference.&lt;/p&gt;
&lt;p&gt;Oh and the quiz, what is the value of the Console.WriteLine in #7?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Answer: NullReferenceExceptinon&amp;nbsp;- Object reference not set to an instance of an object&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Still confused? Then I didn't do my job right, since this is the point in the article when I thought pictures would help. So please post your thoughts whether it makes sense or not. &lt;/p&gt;
&lt;p&gt;- Lee&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Multi Value Columns Solution #2 - Custom Activities in SPD</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/multi_value_columns_solution_2.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/multi_value_columns_solution_2.html</guid>
        <pubDate>Sun, 15 Apr 2007 12:26:09 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;In the previous post in this series (&lt;a href=&quot;http://www.nearinfinity.com/blogs/page/lrichard?entry=multi_value_columns_in_sharepoint&quot;&gt;Multi-Value Columns in SharePoint Designer - Solution #1&lt;/a&gt;), I described a problem where SharePoint Designer can't send e-mail to multiple recipients if those recipients exist inside of a multi-value column in a SharePoint list. The simple hacky solution I described was to temporarily turn the column into a single value column just for SharePoint Designer. But this approach has problems, and there is a better way: developing custom activities in Visual Studio for use in SharePoint Designer.&lt;/p&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--.LeeCode {overflow: auto; white-space: nowrap; background: #ffffcc; color: #000000; border: 1px solid #999999; width: 100%; height: 200px; padding-bottom: 16px; }--&gt;&lt;/style&gt;

&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
        var currentPageUrl = 'http://rapidapplicationdevelopment.blogspot.com/2007/04/multi-value-columns-solution-2-custom.html';

        /* Digg */
        var diggIframe = document.createElement('iframe');
        diggIframe.setAttribute('src', 'http://digg.com/tools/diggthis.php?u=' + currentPageUrl);
        diggIframe.setAttribute('height', '80');
        diggIframe.setAttribute('width', '52');
        diggIframe.setAttribute('frameborder', '0');
        diggIframe.setAttribute('scrolling', 'no');
        
        /* Reddit */
        var redditIframe = document.createElement('iframe');
        redditIframe.setAttribute('src', 'http://reddit.com/button?t=2&amp;amp;url=' + currentPageUrl);
        redditIframe.setAttribute('height', '80');
        redditIframe.setAttribute('width', '52');
        redditIframe.setAttribute('frameborder', '0');
        redditIframe.setAttribute('scrolling', 'no');

        /* DotNetKicks */
        var dotnetkicksLink = document.createElement('a');
        dotnetkicksLink.setAttribute('href', 'http://www.dotnetkicks.com/kick/&amp;amp;url=' + currentPageUrl);
        dotnetkicksLink.setAttribute('style', 'text-align: center;');
        var dotnetkicksImg = document.createElement('img');
        dotnetkicksImg.setAttribute('src', 'http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=' + currentPageUrl);
        dotnetkicksImg.setAttribute('alt', 'Kick this article (a good thing) on DotNetKicks');
        dotnetkicksImg.setAttribute('border', '0');
        dotnetkicksImg.setAttribute('style', 'margin-left:auto; margin-right:auto; display:block; text-align:center;');
        dotnetkicksLink.appendChild(dotnetkicksImg);

        /* combine &amp; write */
        var div = document.createElement('div');
        div.appendChild(diggIframe);
        div.appendChild(redditIframe);
        div.appendChild(document.createElement('br'));
        div.appendChild(document.createElement('br'));
        div.appendChild(dotnetkicksLink);

        document.write(div.innerHTML);
    &lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;In this post I will describe how to develop a custom activity in Visual Studio that will also solve this problem and I will also describe how to install it on a SharePoint server so that SharePoint Designer clients can automatically download and use it. Before I do let me back up and tell you why, from my perspective, this approach is probably not the best way to go.&lt;/p&gt;
&lt;p&gt;SharePoint Designer is a Microsoft Office product that replaces FrontPage, integrates tightly with SharePoint, and allows non-developers (aka &quot;knowledge workers&quot; in the Microsoft lingo) to create simple workflows without writing any code. &lt;/p&gt;
&lt;p&gt;The problem is that &lt;i&gt;simple&lt;/i&gt; workflows and multi-value columns are like oil and water: not so compatible. If you're using multi-value columns then your knowledge workers should admit defeat and let developers create the workflows in Visual Studio using the Windows Workflow Foundation (which, incidentally, will be the topic for third article in this series). &lt;/p&gt;
&lt;p&gt;Still, you may have a good reason for continuing to develop workflows in SharePoint Designer, and I've already gone through the pain of writing and installing custom activities, so hopefully this post will make life easier for someone somewhere.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Creating the Custom Activity in Visual Studio&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The code to create the custom activity in Visual Studio is the most interesting part of this solution. Make sure to check out the GetEmailAddressesFromUsernames() method if you have time to review the code. Here is the procedure assuming this is your first time working with Windows Workflow Foundation in Visual Studio.&lt;/p&gt;
&lt;p&gt;1. The first step is to download and install &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=5d61409e-1fa3-48cf-8023-e8f38e709ba6&amp;amp;DisplayLang=en&quot; target=&quot;_blank&quot;&gt;Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation)&lt;/a&gt; which will add workflow options to Visual Studio.&lt;/p&gt;
&lt;p&gt;2. If you aren't running on Windows Server 2003, then you probably need to install the Windows Workflow Foundation DLL's. You'll know there's a problem if, after creating the project in Visual Studio, your SharePoint references are invalid. I picked these DLL's up from my Windows Server 2003 machine (actually a VMWare virtual machine) from the following location:&lt;/p&gt;
&lt;p&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI&lt;/p&gt;
&lt;p&gt;You should install these to the Global Assembly Cache (GAC) to make Visual Studio happier, although you may still need to reference them for your project. The easy way to install to the GAC is just to copy them to somewhere on your local (non-W2K3) machine and then drag them all over to C:\Windows\assembly.&lt;/p&gt;
&lt;p&gt;3. After completing step #1 when you open Visual Studio you should get a new tree node under &quot;Visual C#&quot; (or Visual Basic) called &quot;Workflow.&quot; Select that, then &quot;Workflow Activity Library&quot; then call the project something like &quot;MultiRecipientMail&quot;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RiACmaZZXyI/AAAAAAAAAGE/3G3Eehuhi9c/s1600-h/01+-+New+Project.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5053041640853823266&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RiACmaZZXyI/AAAAAAAAAGE/3G3Eehuhi9c/s400/01+-+New+Project.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4. Visual Studio should automatically create a blank activity called Activity1.cs. If you want a more reasonable name then delete it and &quot;Add&quot; a &quot;New Item&quot; of type &quot;Activity&quot; called something like &quot;MultiRecipientMailActivity.&quot; Don't make the same painful mistake as me: name your activity something other than the name of the project or anything in the namespace.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RiACmqZZXzI/AAAAAAAAAGM/XrVlspgOstA/s1600-h/02+-+New+Activity.jpg&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RiACmqZZXzI/AAAAAAAAAGM/XrVlspgOstA/s400/02+-+New+Activity.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;5. At this point you could drag and drop a &quot;Replicator&quot; activity on the design surface and put a &quot;Send Mail&quot; activity inside, but I'll cover that in my next post. For now I think code is the clearer way to go. Hit F7 or right click and &quot;View Code&quot; and paste the following which I'll try to comment in-line rather than in this article.&lt;/p&gt;
&lt;p&gt;(for the code see the original article &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/04/multi-value-columns-solution-2-custom.html&quot;&gt;Multi Value Columns Solution #2 - Custom Activities in SPD&lt;/a&gt; on BlogSpot)&lt;/p&gt;
&lt;p&gt;You'll need to substitute your own public key token from step 9 in the &quot;Assembly=&quot; statement.&lt;/p&gt;
&lt;p&gt;12. Next you need to tell SharePoint designer clients to trust this new dll. To do so open the Web.Config in the virtual directory for your site (e.g. C:\Inetpub\wwwroot\wss\VirtualDirectories\34089\ web.config). Find the section called&amp;nbsp;&quot;&quot; and add the following new line (substitute your own public token):&lt;/p&gt;
&lt;p&gt;&lt;authorizedtype authorized=&quot;True&quot; typename=&quot;*&quot; namespace=&quot;MultiRecipientMail&quot; assembly=&quot;MultiRecipientMail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d73739679587735e&quot;&gt;&lt;/p&gt;
&lt;p&gt;(again substitute your own public key token)&lt;/p&gt;
&lt;p&gt;13. Restart IIS by opening a command prompt and typing &quot;iisreset.&quot; SharePoint will pick up the new MultiRecipientMail.ACTIONS file, find the dll in the GAC, and provide the new information to any SharePoint Designer clients that access the site.&lt;/p&gt;
&lt;p&gt;14. Open SharePoint Designer and either navigate to the &quot;Workflows\Multi Recipient Email.xoml&quot; project from &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/04/multi-value-columns-in-sharepoint.html&quot; target=&quot;_blank&quot;&gt;my previous article&lt;/a&gt; or create a new workflow project based on a list with a multi-value column. You should get a message like the following while SharePoint Designer downloads the new dll:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RiACm6ZZX2I/AAAAAAAAAGk/J54ZfzfWNEs/s1600-h/05+-+Download+Necessary+Info.jpg&quot;&gt;&lt;img id=&quot;Img4&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RiACm6ZZX2I/AAAAAAAAAGk/J54ZfzfWNEs/s400/05+-+Download+Necessary+Info.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;15. If everything worked correctly you should now be able to 1. click Actions; 2. More Actions; 3. Select the &quot;Custom Actions&quot; category from the dropdown (this category came from the .ACTIONS file in Step 11); and 4. Select the &quot;Multi Recipient E-mail&quot; action. If it doesn't show up in the Workflow Designer page after clicking &quot;add&quot;, then you probably referenced it incorrectly in the Web.Config.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RiADG6ZZX3I/AAAAAAAAAGs/nciVJ2e82ec/s1600-h/06+-+Add+Custom+Action.jpg&quot;&gt;&lt;img id=&quot;Img5&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RiADG6ZZX3I/AAAAAAAAAGs/nciVJ2e82ec/s400/06+-+Add+Custom+Action.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;16. Now you should be able to 1. click the Fx button next to &quot;To;&quot; 2. Select your multi value column (e.g. Peers To Review from my previous article); 3. Hit Ok; and 4. Fill in the remaining fields with values.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://bp3.blogger.com/_gez10dNhuPk/RiADHKZZX4I/AAAAAAAAAG0/Ppbwh5_FOVA/s1600-h/07+-+Map+Multi+Value+Column.jpg&quot;&gt;&lt;img id=&quot;Img6&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;http://bp3.blogger.com/_gez10dNhuPk/RiADHKZZX4I/AAAAAAAAAG0/Ppbwh5_FOVA/s400/07+-+Map+Multi+Value+Column.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;17. Now if you head back to Sharepoint, select the dropdown of a list item in the list associated with your workflow, click &quot;Workflows&quot;, select the workflow you created in SharePoint Designer, and click &quot;Start&quot; you should receive an e-mail at each address in your multi-value column. &lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rhpl4PjlR7I/AAAAAAAAAFk/xzgr_rETjWs/s1600-h/06+-+Start+Workflow.jpg&quot;&gt;&lt;img id=&quot;Img7&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rhpl4PjlR7I/AAAAAAAAAFk/xzgr_rETjWs/s400/06+-+Start+Workflow.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Well, at least it worked for me. :) I did kitchen test this article, but please leave comments if it doesn't work for you.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Redeploying&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;If you want to make any changes to the code the steps to redeploy are:&lt;/p&gt;
&lt;p&gt;1. Compile (you don't need to sign again, that's one time only)&lt;/p&gt;
&lt;p&gt;2. Copy the dll to your W2K3 server&lt;/p&gt;
&lt;p&gt;3. Re-install the dll to the GAC. You can just re-copy it over to c:\windows\assembly if you like.&lt;/p&gt;
&lt;p&gt;4. Restart iis with an &quot;iisreset&quot; from the command line (no need to change the .ACTIONS or Web.Config files)&lt;/p&gt;
&lt;p&gt;5. Finally, if you need to make changes to your workflow, you may need to restart SharePoint Designer to download the new dll (I usually have to).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;You're Done! Easy huh?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;So you should now have a reusable component that non-developers can use in SharePoint Designer to send e-mail to multiple recipients as determined by a multi-value column in a SharePoint list. Of course if you decide that developing the workflow in Visual Studio is better, then the third article in this series may be for you.&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Multi-Value Columns in SharePoint Designer - Solution #1</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/multi_value_columns_in_sharepoint.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/multi_value_columns_in_sharepoint.html</guid>
        <pubDate>Mon, 09 Apr 2007 12:58:25 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;div style=&quot;FLOAT: right; MARGIN-LEFT: 10px&quot;&gt;&lt;/div&gt;
&lt;p&gt;Recently I've been working with Microsoft Office SharePoint Server (MOSS) 2007. Since this is my first post on the topic I'd love to start at a high level about what it is and how it works, but let's get to the interesting stuff: what doesn't work well and how to get around it.&lt;/p&gt;
&lt;p&gt;Specifically, this will be the first in a series regarding a deficiency in the workflow component of SharePoint that doesn't allow you to send e-mail to multiple recipients from a multi-value column of a list using SharePoint Designer 2007 (SPD).&lt;/p&gt;
&lt;p&gt;This first post will describe the problem, provide lots of screenshots so it can double as a fast introduction to workflows in SharePoint for the uninitiated, and then provide a quick hacky solution.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;The Multi-Value Column Problem&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Here's how it should work. You create a list (e.g. Performance Review) and add a column (e.g. &quot;Peers To Review&quot;) and select a type of &quot;Person or Group&quot; with &quot;Allow multiple selections&quot; set to Yes. &lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RhpsnPjlR-I/AAAAAAAAAF8/rXIhc4osgvk/s1600-h/01+-+Create+Column.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5051469353495906274&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RhpsnPjlR-I/AAAAAAAAAF8/rXIhc4osgvk/s400/01+-+Create+Column.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(click any image to enlarge)&lt;/p&gt;
&lt;p&gt;Now if you add a blank workflow in SharePoint Designer (from the SharePoint Content tab):&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/Rhpkl_jlR3I/AAAAAAAAAFE/FHjSx-RaRWA/s1600-h/02+-+CreateWorkflow.jpg&quot;&gt;&lt;img id=&quot;Img1&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/Rhpkl_jlR3I/AAAAAAAAAFE/FHjSx-RaRWA/s400/02+-+CreateWorkflow.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And you select the list you created (Performance Review):&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp0.blogger.com/_gez10dNhuPk/RhplH_jlR4I/AAAAAAAAAFM/kDZP4wGOIZ8/s1600-h/03+-+Select+List.jpg&quot;&gt;&lt;img id=&quot;Img6&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp0.blogger.com/_gez10dNhuPk/RhplH_jlR4I/AAAAAAAAAFM/kDZP4wGOIZ8/s400/03+-+Select+List.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then you should be able to&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add a &quot;Send an Email&quot; action&lt;/li&gt;
&lt;li&gt;View the message's properties&lt;/li&gt;
&lt;li&gt;Select the recipient&lt;/li&gt;
&lt;li&gt;Add a function by clicking &quot;Workflow Lookup&quot;&lt;/li&gt;
&lt;li&gt;Select the Current Item (aka the current list item, which is like a row in a spreadsheet and in my example this would be the current performance review that the workflow is being run on)&lt;/li&gt;
&lt;li&gt;Then select the new column &quot;Peers to Review&quot;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RhplYfjlR5I/AAAAAAAAAFU/owi3WxSVE5g/s1600-h/04+-+Add+Action.jpg&quot;&gt;&lt;img id=&quot;Img5&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RhplYfjlR5I/AAAAAAAAAFU/owi3WxSVE5g/s400/04+-+Add+Action.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But wait. Where's your column? And here is the problem. The UI of SharePoint Designer filters out all columns that are marked with &quot;Allow multiple selections.&quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Simple Hacky Solution #1&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Believe it or not the Workflow Engine knows how to send e-mail to a column with &quot;Allow multiple selections&quot; but it's the SharePoint Designer UI that doesn't. This means that a simple solution to the problem is this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Turn off &quot;Allow multiple selections&quot; for your column (note the warning &quot;This will remove all person values except the first one&quot;)&lt;/li&gt;
&lt;li&gt;Close and reopen the workflow in SharePoint Designer and follow steps above and magically your column will appear in the dropdown &lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp2.blogger.com/_gez10dNhuPk/RhprffjlR9I/AAAAAAAAAF0/ZvhJlPJTVz0/s1600-h/05+-+Select+Column.jpg&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5051468120840292306&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp2.blogger.com/_gez10dNhuPk/RhprffjlR9I/AAAAAAAAAF0/ZvhJlPJTVz0/s400/05+-+Select+Column.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Finish creating your workflow&lt;/li&gt;
&lt;li&gt;Turn back on &quot;Allow multiple selections&quot;&lt;/li&gt;
&lt;li&gt;Create an item for the list and run the workflow you created in SharePoint Designer&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rhpl4PjlR7I/AAAAAAAAAFk/xzgr_rETjWs/s1600-h/06+-+Start+Workflow.jpg&quot;&gt;&lt;img id=&quot;Img3&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/Rhpl4PjlR7I/AAAAAAAAAFk/xzgr_rETjWs/s400/06+-+Start+Workflow.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And voila, it works! Both (or all) recipients have received an e-mail.&lt;/p&gt;
&lt;p&gt;Sadly, this simple technique isn't an acceptable solution for the long term. What happens if you want to change your workflow down the road? You may need to turn &quot;Allow multiple selections&quot; back off, thus deleting your multi-user data. A better solution is to create a custom action in Visual Studio and get it to plug into SharePoint Designer. And that will be the topic of my next post:&lt;/p&gt;
&lt;p&gt;Multi-Value Columns in SharePoint Designer - Solution #2&lt;/p&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;Note 1: this series is largely in response to the several users having similar problems at: &lt;a href=&quot;http://forums.microsoft.com/MSDN/showpost.aspx?postid=1443799&amp;amp;siteid=1&quot; target=&quot;_blank&quot;&gt;http://forums.microsoft.com/MSDN/showpost.aspx?postid=1443799&amp;amp;siteid=1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note 2: If you're interested in the ERD for the topics in this SharePoint post this diagram might be useful to get you up to speed:&lt;/p&gt;
&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://bp1.blogger.com/_gez10dNhuPk/RhpmEPjlR8I/AAAAAAAAAFs/jddUXdb0PrI/s1600-h/07+-+Workflow+ERD.jpg&quot;&gt;&lt;img id=&quot;Img2&quot; style=&quot;CURSOR: pointer&quot; alt=&quot;&quot; src=&quot;http://bp1.blogger.com/_gez10dNhuPk/RhpmEPjlR8I/AAAAAAAAAFs/jddUXdb0PrI/s400/07+-+Workflow+ERD.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note 3: This is double posted at &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/04/multi-value-columns-in-sharepoint.html&quot; target=&quot;_blank&quot;&gt;http://rapidapplicationdevelopment.blogspot.com/2007/04/multi-value-columns-in-sharepoint.html&lt;/a&gt;&lt;/p&gt; 
</description>
        
          <category term=".net" label=".net"/>
        
      </item>
    
      <item>
        <title>Entity Naming Conventions</title>
        <link>http://www.nearinfinity.com/blogs/lee_richardson/entity_naming_conventions.html</link>
        <guid>http://www.nearinfinity.com/blogs/lee_richardson/entity_naming_conventions.html</guid>
        <pubDate>Mon, 26 Mar 2007 10:14:17 -0400</pubDate>
        
        <author>Lee Richardson</author>
        
        <description>&lt;p&gt;It seems as though as software developers mature they develop consistency in their approach to just about every aspect of their work, regardless if there is a good reason for adopting a particular practice or not.&lt;/p&gt;
&lt;p&gt;For instance, in data modeling I developed the habit of always naming my tables in the plural&amp;nbsp;- Employees instead of Employee, and such. There's no reason for this convention, other than perhaps I copied what I saw from the Northwind database.&lt;/p&gt;
&lt;p&gt;But it's important to question these practices from time to time, and after over seven years of doing things the same way I have decided to make a change. And for the second time now (see my post &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/01/importance-of-logical-data-model.html&quot;&gt;The Importance of a Logical Data Model&lt;/a&gt;), it was a colleague: Steve Dempsey who initiated the change. So why would one opt for singular names over plural ones?&lt;/p&gt;
&lt;p&gt;Developers might chose singular names because they are shorter and require less typing, but this argument never held for me because of tools like intellisense and code generation (not to mention touch typing). But Steve is extremely adamant about singular names for a different reason: because of relationship readability.&lt;/p&gt;
&lt;p&gt;For instance, in Sharepoint, workflows relate to events. Specifically, a workflow (singular) is initiated by one and only one event, and an event (singular) can initiate multiple workflows, as is expressed below:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://www.nearinfinity.com/blogs/resources/lrichard/Singular.gif&quot; border=&quot;0&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The objective of modeling is thus to express the relationship of a single entity (a workflow, an event, or whatever) to zero or one or many of another entity. So why not just name your entities appropriately in the first place: by making them singular?&lt;/p&gt;
&lt;p&gt;Of course now the problem is getting an old dog to remember his new trick. Or is it tricks?&lt;/p&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;&lt;small&gt;note: I am now double posting my blog entries, this post is also available on &lt;a href=&quot;http://rapidapplicationdevelopment.blogspot.com/2007/03/entity-naming-conventions.html&quot;&gt;Blogspot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt; 
</description>
        
          <category term="sql" label="sql"/>
        
      </item>
    
  </channel> 
</rss>

