<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ShinyLight Development &#187; Databases</title>
	<atom:link href="http://www.shinylight.com/category/databases/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shinylight.com</link>
	<description>Web Development and Other Goodness in the World of a Software Engineer.</description>
	<lastBuildDate>Mon, 09 Jan 2012 00:18:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>msdb.dbo.sp_sqlagent_get_perf_counters high CPU</title>
		<link>http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/</link>
		<comments>http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 05:24:38 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1205</guid>
		<description><![CDATA[That stored proc generates server stats, and depending on the stat results, it will fire off the alerts in SQL Server. If that instance of that stored proc hangs or has abnormally high CPU, just kill it. The agent will fire it again when needed. 
Also, by default, SQL Server comes with a set of [...]]]></description>
			<content:encoded><![CDATA[<p>That stored proc generates server stats, and depending on the stat results, it will fire off the alerts in SQL Server. If that instance of that stored proc hangs or has abnormally high CPU, just kill it. The agent will fire it again when needed. </p>
<p>Also, by default, SQL Server comes with a set of alerts that the server can use (called, “Demo”). I would keep the alerts active if possible and see what alerts are being triggered and why – check logs. </p>
<p>There was also a bug on SQL Server 2008 that was fixed that stemmed from this proc causing high CPU, even if all Alerts are disabled. I’m not sure if this fix applied to SQL Server 2000 with latest SP. </p>
<p>More details: http://connect.microsoft.com/SQLServer/feedback/details/536354/execute-msdb-dbo-sp-sqlagent-get-perf-counters-hogs-cpu-although-no-alerts-enabled#details </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;submitHeadline=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;title=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;title=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;title=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;bm_description=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;T=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;title=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;title=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU+@+http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/&amp;t=msdb.dbo.sp_sqlagent_get_perf_counters+high+CPU" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/24/msdb-dbo-sp_sqlagent_get_perf_counters-high-cpu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with the MongoDB C# Driver</title>
		<link>http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/</link>
		<comments>http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 02:05:40 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1108</guid>
		<description><![CDATA[Here&#8217;s my attempt on writing a super-barebones tutorial for using the MongoDB C# Driver. It&#8217;s a very hands-on tutorial-by-example, showing you the basics of the driver by creating console apps. 
I&#8217;m assuming you&#8217;ve installed the official MongoDB C# driver and read the intro. Heads up on how you set up the driver. The .msi sets [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my attempt on writing a super-barebones tutorial for using the MongoDB C# Driver. It&#8217;s a very hands-on tutorial-by-example, showing you the basics of the driver by creating console apps. </p>
<p>I&#8217;m assuming you&#8217;ve installed the official <a href="http://www.mongodb.org/display/DOCS/CSharp+Language+Center">MongoDB C# driver</a> and <a href="http://www.mongodb.org/display/DOCS/Introduction">read the intro</a>. Heads up on how you set up the driver. The .msi sets it up in the GAC. The zip file has the assemblies that can just be referenced in your project. </p>
<p>After you&#8217;ve done those two things, you can proceed. <img src='http://www.shinylight.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Dependencies</h3>
<p>In projects, you have the option of utilizing the following namespaces:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Driver</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.IO</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.Serialization</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.Serialization.Attributes</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.Serialization.Conventions</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.Serialization.IdGenerators</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.Serialization.Options</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Bson.Serialization.Serializers</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Driver.Builders</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Driver.GridFS</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MongoDB.Driver.Wrappers</span><span style="color: #008000;">;</span></pre></div></div>

<p>The most commonly used are Bson, Driver, Serialization, and Serialization.Attributes. This tutorial will use these four in all code samples, so make sure you include them in your app, even if I don&#8217;t have it in the code samples. You can learn more about the <a href="http://api.mongodb.org/csharp/">API/namespaces</a> by <a href="http://api.mongodb.org/csharp/">checking out the docs</a>.</p>
<h3>Connecting to a MongoDB Database</h3>
<p>Connecting is pretty simple. Once you include the C# driver assemblies, you connect as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> ConsoleApplication1
<span style="color: #000000;">&#123;</span>
  <span style="color: #FF0000;">class</span> Program
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      MongoServer  server <span style="color: #008000;">=</span> MongoServer.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;mongodb://work2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      MongoDatabase Cars <span style="color: #008000;">=</span> server.<span style="color: #0000FF;">GetDatabase</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Cars&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>That&#8217;s pretty much all you need to connect. Of course, I recommend putting the connection string in the Web.config, or some initializer.</p>
<h3>Inserting a document on MongoDB</h3>
<p>There are tons of ways to do this, but one of the simplest ways is to create a class, create an instances of that class, and pass it into a MongoDB object that serializes that object into BSON and submits it to your database. </p>
<p>So for this example, before inserting a document into the database from C#, one has to do two things (aside from the establishing a connection and choosing which db to write to):</p>
<ol>
<li>Create a Generic Collection object. In this case, it’s a MongoDB collection.</li>
<li> Create a class that’s to be used by the Generic Collection.</li>
</ol>
<p>Those two go together.</p>
<p><em><span style="text-decoration: underline;">Also, note</span> that while working with MongoDB in C#, the word “collection” may be thrown around loosely. In MongoDB you have a “Collection” that’s comparable to a Table in a traditional ER database. A MongoDB “Collection” holds “documents,” which is comparable to a “record” in a traditional ER database. On the opposite side, in C#, a collection is a data structure that unlike an Array, can be resized dynamically and is more flexible as far as functionality.<br />
 </em></p>
<p>The MongoDB Generic Collection is a C# collection that can hold any type of object, but it has to know what type of object it’s holding. You let it know what kind of type by creating a class, and then when you create a collection, you specify the name of the class. So for example, this is the syntax for creating a Generic Collection that has Car objects (where person is defined in a class):</p>
<p style="text-align: center;"><img class="size-full wp-image-1079 aligncenter" title="mongodb-1" src="http://www.shinylight.com/wp-content/uploads/2011/06/mongodb-1.png" alt="" width="369" height="155" /></p>
<p>After that line of code, you populate the vehicles object (remember it’s a MongoDB Generic collection that holds Cars objects), by calling the method “GetCollection” from the Cars object we creating in the last section “Connecting to a MongoDB database”:</p>
<p style="text-align: center;"><img class="size-full wp-image-1080 aligncenter" title="mongodb-2" src="http://www.shinylight.com/wp-content/uploads/2011/06/mongodb-2.png" alt="" width="477" height="183" /></p>
<p>In the above statement, if MongoDB does not find a collection on the database called “vehicles,” it will create it for you.</p>
<p>What does that Cars class look like? Pretty simple:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Cars
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> _id <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> brand <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> lname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Int32 miles <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> age <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then of course, before sending it to the MongoDB database, you create an object and set the values of the object:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">      Cars newCar <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Cars<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar._id <span style="color: #008000;">=</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Guid</span>.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">brand</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Honda&quot;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">miles</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">186000</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">age</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span></pre></div></div>

<p>And then insert it in MongoDB:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">vehicles.<span style="color: #0000FF;">Insert</span><span style="color: #000000;">&#40;</span>newCar<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>To put it in perspective, here’s the entire program:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> ConsoleApplication1
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Cars
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> _id <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> brand <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> lname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Int32 miles <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> age <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #FF0000;">class</span> Program
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>       
&nbsp;
      MongoServer  server <span style="color: #008000;">=</span> MongoServer.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;mongodb://work2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      MongoDatabase Cars <span style="color: #008000;">=</span> server.<span style="color: #0000FF;">GetDatabase</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Cars&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCollection vehicles<span style="color: #008000;">;</span>
&nbsp;
      vehicles <span style="color: #008000;">=</span> Cars.<span style="color: #0000FF;">GetCollection</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;vehicles&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      Cars newCar <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Cars<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar._id <span style="color: #008000;">=</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Guid</span>.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">brand</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Honda&quot;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">miles</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">186000</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">age</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>      
&nbsp;
      vehicles.<span style="color: #0000FF;">Insert</span><span style="color: #000000;">&#40;</span>newCar<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The insert method should serialize the Cars object (newCar) and create the MongoDB document, mapping the properties of the Cars class to MongoDB document key-pair values.</p>
<p>Let’s see how this got created in our database:</p>
<p>Run:</p>
<p>db.vehicles.find()</p>
<p><img class="alignnone size-full wp-image-1081" title="mongodb-3" src="http://www.shinylight.com/wp-content/uploads/2011/06/mongodb-3.png" alt="" width="540" height="23" /></p>
<p>(e.g. ignore the lname property. This was removed in the source code)</p>
<h3>Inserting Complex Objects in MongoDB</h3>
<p>Let’s try inserting an object with a more complex data structure. Let’s assume we have the following class:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Cars
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> _id <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> brand <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> lname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Int32 miles <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> age <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> Hashtable history <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Hashtable complex <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> magicNumbers <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now let’s declare the class and its properties:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">      newCar._id <span style="color: #008000;">=</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Guid</span>.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">brand</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Honda&quot;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">miles</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">186000</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">age</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
      newCar.<span style="color: #0000FF;">history</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Hashtable<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>   
      newCar.<span style="color: #0000FF;">history</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;2010-08-14&quot;</span>, <span style="color: #666666;">&quot;Puss 'N Boots&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">history</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;2011-12-01&quot;</span>, <span style="color: #666666;">&quot;Puff the Magic Dragon&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">history</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;2009-03-07&quot;</span>, <span style="color: #666666;">&quot;Fraggle Rock&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>      
&nbsp;
      newCar.<span style="color: #0000FF;">magicNumbers</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">60</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">186000</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1440</span><span style="color: #008000;">;</span>
&nbsp;
      newCar.<span style="color: #0000FF;">complex</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Hashtable<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">complex</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span>, newCar.<span style="color: #0000FF;">history</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">complex</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Guid</span>.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, newCar.<span style="color: #0000FF;">history</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>It outputs the following (formatted for better reading):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">{
  &quot;_id&quot;: &quot;a07513c8-9cb5-46cd-a9cb-425cabc0dd76&quot;,
  &quot;brand&quot;: &quot;Honda&quot;,
  &quot;lname&quot;: null,
  &quot;miles&quot;: 186000,
  &quot;age&quot;: 1,
  &quot;history&quot;: 
  {
    &quot;2010-08-14&quot;: &quot;Puss 'N Boots&quot;,
    &quot;2009-03-07&quot;: &quot;Fraggle Rock&quot;,
    &quot;2011-12-01&quot;: &quot;Puff the Magic Dragon&quot;
  },
  &quot;complex&quot;: 
  [
    [&quot;eb7b3d4d-87b1-43c1-9fe7-5a5e4b5b79de&quot;,
    {
        &quot;2010-08-14&quot;: &quot;Puss 'N Boots&quot;,
        &quot;2009-03-07&quot;: &quot;Fraggle Rock&quot;,
        &quot;2011-12-01&quot;: &quot;Puff the Magic Dragon&quot;
    }],
    [
    186000,
    {
        &quot;2010-08-14&quot;: &quot;Puss 'N Boots&quot;,
        &quot;2009-03-07&quot;: &quot;Fraggle Rock&quot;,
        &quot;2011-12-01&quot;: &quot;Puff the Magic Dragon&quot;
    }]
  ],
  &quot;magicNumbers&quot;: [60, 186000, 1440]
}</pre></div></div>

<p>Now let’s look at the entire code for all this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> ConsoleApplication1
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Cars
  <span style="color: #000000;">&#123;</span>     
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> _id <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>   
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> brand <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>  
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> lname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>  
    <span style="color: #0600FF;">public</span> Int32 miles <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>  
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> age <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> Hashtable history <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Hashtable complex <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> magicNumbers <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #FF0000;">class</span> Program
  <span style="color: #000000;">&#123;</span>   
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
&nbsp;
      MongoServer  server <span style="color: #008000;">=</span> MongoServer.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;mongodb://work2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>          
      MongoDatabase Cars <span style="color: #008000;">=</span> server.<span style="color: #0000FF;">GetDatabase</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Cars&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCollection<span style="color: #008000;">&lt;</span>Cars<span style="color: #008000;">&gt;</span> vehicles<span style="color: #008000;">;</span>
&nbsp;
      vehicles <span style="color: #008000;">=</span> Cars.<span style="color: #0000FF;">GetCollection</span><span style="color: #008000;">&lt;</span>Cars<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;vehicles&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      Cars newCar <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Cars<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      newCar._id <span style="color: #008000;">=</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Guid</span>.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">brand</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Honda&quot;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">miles</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">186000</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">age</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
      newCar.<span style="color: #0000FF;">history</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Hashtable<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>   
      newCar.<span style="color: #0000FF;">history</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;2010-08-14&quot;</span>, <span style="color: #666666;">&quot;Puss 'N Boots&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">history</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;2011-12-01&quot;</span>, <span style="color: #666666;">&quot;Puff the Magic Dragon&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">history</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;2009-03-07&quot;</span>, <span style="color: #666666;">&quot;Fraggle Rock&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>      
&nbsp;
      newCar.<span style="color: #0000FF;">magicNumbers</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">60</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">186000</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">1440</span><span style="color: #008000;">;</span>
&nbsp;
      newCar.<span style="color: #0000FF;">complex</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Hashtable<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">complex</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> newCar.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span>, newCar.<span style="color: #0000FF;">history</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      newCar.<span style="color: #0000FF;">complex</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Guid</span>.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, newCar.<span style="color: #0000FF;">history</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
&nbsp;
      vehicles.<span style="color: #0000FF;">Insert</span><span style="color: #008000;">&lt;</span>Cars<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span>newCar<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>         
&nbsp;
      Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>                
    <span style="color: #000000;">&#125;</span>     
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<h3>Reading the 1st MongoDB document from the database</h3>
<p>Before you query the database, you must make sure the class and member types match the values/objects that the MongoDB connection will return.</p>
<p>Let’s try to fetch the 1st document. To see what we’re expecting, let’s fetch it via the console first:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">db.vehicles.find().limit(1)</pre></div></div>

<p>which returns:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">{
  &quot;_id&quot; : ObjectId(&quot;4d95f30058430000007a5943&quot;),
  &quot;ObjectId&quot; : ObjectId(&quot;000000000000000000000000&quot;),
  &quot;brand&quot; : &quot;Ford&quot;,
  &quot;lname&quot; : null,
  &quot;miles&quot; : 2500,
  &quot;age&quot; : 1
}</pre></div></div>

<p>Now that we know what it returns, let’s make sure we have the class in place that will handle the kind of key-value pairs in the MongoDB collection:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Cars
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> _id <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> ObjectId <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> brand <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> lname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Int32 miles <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> age <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Complex Properties</span>
    <span style="color: #0600FF;">public</span> Hashtable history <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Hashtable complex <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> magicNumbers <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Notice that the properties history, complex, and magicNumbers are not part of the MongoDB document we queried. That’s OK. The MongoDB C# drivers are smart enough to map to to a null value when deserializing from MongoDB to a C# object.</p>
<p>Now how do you map values from a MongoDB connection to a C# object? Like so:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">    Cars car <span style="color: #008000;">=</span> vehicles.<span style="color: #0000FF;">FindOne</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>The FindOne() method will return the first document. Now let’s add some context to this line of code, by adding MongoDB connection code (that we established before), writing it to the screen, and checking for nulls in the complex properties:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> ConsoleApplication1
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Cars
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> _id <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> ObjectId <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> brand <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> lname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Int32 miles <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> age <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">// Complex Properties</span>
    <span style="color: #0600FF;">public</span> Hashtable history <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> Hashtable complex <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> magicNumbers <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #FF0000;">class</span> Program
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      MongoServer  server <span style="color: #008000;">=</span> MongoServer.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;mongodb://work2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      MongoDatabase Cars <span style="color: #008000;">=</span> server.<span style="color: #0000FF;">GetDatabase</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Cars&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCollection vehicles<span style="color: #008000;">;</span>
      vehicles <span style="color: #008000;">=</span> Cars.<span style="color: #0000FF;">GetCollection</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;vehicles&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      Cars car <span style="color: #008000;">=</span> vehicles.<span style="color: #0000FF;">FindOne</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car._id<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">ObjectId</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">brand</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">lname</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">miles</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">age</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">history</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;history was null&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF;">else</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">history</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">complex</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;complex was null&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF;">else</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">complex</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">magicNumbers</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;magicNumbers was null&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #0600FF;">else</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>car.<span style="color: #0000FF;">magicNumbers</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>                  
&nbsp;
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;ha made it this far!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>This will print the following on to the screen:</p>
<p><img class="alignnone size-full wp-image-1086" title="mongo1" src="http://www.shinylight.com/wp-content/uploads/2011/06/mongo1.png" alt="" width="369" height="146" /></p>
<h3>Read All Documents from a MongoDB Collection</h3>
<p>Let’s try to output all the documents from a collection. We’re going to create a new MongoDB collection under the Cars database. Through the MongoDB client, we’ve created four documents. Let’s read them from the console first:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">db.bankaccount.find()</pre></div></div>

<p>The four documents look like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">{ &quot;_id&quot; : ObjectId(&quot;4d9650301b6e000000004116&quot;), &quot;name&quot; : &quot;Batman&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d9650391b6e000000004117&quot;), &quot;name&quot; : &quot;Spider-Man&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d96503f1b6e000000004118&quot;), &quot;name&quot; : &quot;Superman&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d9650431b6e000000004119&quot;), &quot;name&quot; : &quot;Spawn&quot; }</pre></div></div>

<p>So the first thing is to create a class that represents each MongoDB document:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> BankAccount
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> _id<span style="color: #008000;">;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> name<span style="color: #008000;">;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<p>The class is used to create an object that will contain the data that is deserialized (from MongoDB to a C# object).</p>
<p>Here’s the code to query all documents, iterating through them and showing them on the screen:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">      MongoCursor cursor <span style="color: #008000;">=</span> BankAccountCollection.<span style="color: #0000FF;">FindAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>BankAccount ba <span style="color: #0600FF;">in</span> cursor<span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>ba._id<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>ba.<span style="color: #0000FF;">name</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;=============================&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Looks straightforward enough. What is a cursor? We can think of a MongoDB Cursor as a DataSet in .NET. Later, we’ll see MongoDB Queries, which resemble a SqlCommand object in .NET. Queries are configurable objects to search for document data. The Query object is then passed into the a find method (there are several) of the MongoCollection. The find method then typically returns a Cursor, which is then iterated through. (More about this later.) Also note that a Cursor is not “populated” with documents until the there’s an attempt to retrieve the first result from the server.</p>
<p>Let’s see the entire program in action.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">namespace</span> ConsoleApplication1
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> BankAccount
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> _id<span style="color: #008000;">;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> name<span style="color: #008000;">;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #FF0000;">class</span> Program
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      MongoServer  server <span style="color: #008000;">=</span> MongoServer.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;mongodb://work2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      MongoDatabase BankAccountDatabase <span style="color: #008000;">=</span> server.<span style="color: #0000FF;">GetDatabase</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Cars&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCollection BankAccountCollection<span style="color: #008000;">;</span>
      BankAccountCollection <span style="color: #008000;">=</span> BankAccountDatabase.<span style="color: #0000FF;">GetCollection</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;bankaccount&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCursor cursor <span style="color: #008000;">=</span> BankAccountCollection.<span style="color: #0000FF;">FindAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>BankAccount ba <span style="color: #0600FF;">in</span> cursor<span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>ba._id<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>ba.<span style="color: #0000FF;">name</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;=============================&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #000000;">&#125;</span>      
&nbsp;
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\n</span><span style="color: #008080; font-weight: bold;">\n</span>ha made it this far!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The above program outputs the following:</p>
<p><img class="alignnone size-full wp-image-1091" title="mongo2" src="http://www.shinylight.com/wp-content/uploads/2011/06/mongo2.png" alt="" width="336" height="220" /></p>
<p>If we wanted to retrieve a specific query, rather than doing this (from the above code):</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> MongoCursor cursor <span style="color: #008000;">=</span> BankAccountCollection.<span style="color: #0000FF;">FindAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>We would do:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">      var query <span style="color: #008000;">=</span> Query.<span style="color: #0000FF;">EQ</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;name&quot;</span>, <span style="color: #666666;">&quot;Batman&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      var cursor <span style="color: #008000;">=</span> BankAccountCollection.<span style="color: #0000FF;">Find</span><span style="color: #000000;">&#40;</span>query<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>One last thing to mention about the Find() method, as stated from <a href="http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial">docs</a>:<br />
<em>The Find method (and its variations) don&#8217;t immediately return the actual results of a query. Instead they return a cursor that can be enumerated to retrieve the results of the query. The query isn&#8217;t actually sent to the server until we attempt to retrieve the first result (technically, when MoveNext is called for the first time on the enumerator returned by GetEnumerator). This means that we can control the results of the query in interesting ways by modifying the cursor before fetching the results.</em></p>
<h3>Get only key-value pairs from a collection</h3>
<p>In this example, we’re going to try to do something like this in SQL:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> Column1<span style="color: #66cc66;">,</span> Column2
<span style="color: #993333; font-weight: bold;">FROM</span>  <span style="color: #993333; font-weight: bold;">TABLE</span></pre></div></div>

<p>We’re also going to be using the collection “bbu”. Let’s try to translate this query:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">db.bbu.find({},{whichAPI:1}).limit(10)</pre></div></div>

<p>Which would return the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">{ &quot;_id&quot; : ObjectId(&quot;4d90fbd85843000000004359&quot;), &quot;whichAPI&quot; : &quot;SL&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d90fbd8584300000000435a&quot;), &quot;whichAPI&quot; : &quot;SL&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d90fbd8584300000000435b&quot;), &quot;whichAPI&quot; : &quot;SIT&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d90fbd8584300000000435c&quot;), &quot;whichAPI&quot; : &quot;SL&quot; }
{ &quot;_id&quot; : ObjectId(&quot;4d90fbd8584300000000435d&quot;), &quot;whichAPI&quot; : &quot;SL&quot; }</pre></div></div>

<p>First, we’re going to define the class. We’re going to establish all the properties that are needed for a class, but then only query and populate two colums from the class.</p>
<p>Define the class and all of its properties.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> BBU
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> MongoDB.<span style="color: #0000FF;">Bson</span>.<span style="color: #0000FF;">ObjectId</span> _id<span style="color: #008000;">;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> counter<span style="color: #008000;">;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> whichAPI<span style="color: #008000;">;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now the actual program:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">  <span style="color: #FF0000;">class</span> Program
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>    
&nbsp;
      MongoServer  server <span style="color: #008000;">=</span> MongoServer.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;mongodb://work2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      MongoDatabase BBUDatabase <span style="color: #008000;">=</span> server.<span style="color: #0000FF;">GetDatabase</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;bbu&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCollection BBUCollection<span style="color: #008000;">;</span>
      BBUCollection <span style="color: #008000;">=</span> BBUDatabase.<span style="color: #0000FF;">GetCollection</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;bbu&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      MongoCursor cursor <span style="color: #008000;">=</span> BBUCollection.<span style="color: #0000FF;">FindAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">SetFields</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;id&quot;</span>,<span style="color: #666666;">&quot;whichAPI&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">SetLimit</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>BBU ba <span style="color: #0600FF;">in</span> cursor<span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>ba._id <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;----&quot;</span> <span style="color: #008000;">+</span> ba.<span style="color: #0000FF;">whichAPI</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;=============================&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #000000;">&#125;</span>      
&nbsp;
      Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\n</span><span style="color: #008080; font-weight: bold;">\n</span>ha made it this far!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>                        
&nbsp;
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<p>In the example above, SetLimit(5) will only return the top 5 documents.</p>
<h3>Conclusion</h3>
<p>I hope you got a good a sense of the basics of using the MongoDB C# driver. I&#8217;ve only scratched the surface of the API. I&#8217;ll be discussing more advanced topics in future posts. </p>
<p>For the meantime, I point you to the MongoDB Google Group: <a href="http://groups.google.com/group/mongodb-user?pli=1">http://groups.google.com/group/mongodb-user?pli=1</a> where you&#8217;ll get informative responses, usually very quickly.</p>
<p>I also recommend you following the following <a href="http://twitter.com/#!/shinylightdev/mongodb/members">folks on Twitter</a> and these blogs/sites:</p>
<ul>
<li><a href="http://blog.boxedice.com/mongodb/">Boxed Ice Blog</a></li>
<li><a href="http://coder.io/tag/mongodb">coder i|o: #mongodb</li>
<li><a href="http://eliothorowitz.com/">Eliot&#8217;s Ramblings</li>
<li><a href="http://blog.zawodny.com">Jeremy Zawodny&#8217;s blog</li>
<li><a href="http://learnmongo.com">LearnMongo.com</li>
<li><a href="http://www.evri.com:80/product/mongodb-0x51089c">MongoDB &#8211; Articles &#8211; Evri</li>
<li><a href="http://www.snailinaturtleneck.com/blog">Snail in a Turtleneck</li>
<li><a href="http://blog.10gen.com/">The 10gen Blog on MongoDB and NoSQL</li>
<li><a href="http://blog.mongodb.org/">MongoDB NoSQL Database Blog</li>
</ul>
<p>Lastly, I recommend you check out the <a href="http://www.10gen.com/presentations?programming_lang=dotnet&#038;event=&#038;application=">MongoDB video presentations</a> using the C# Driver and working in a Microsoft environment.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;submitHeadline=Getting+Started+with+the+MongoDB+C%23+Driver&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;title=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;title=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;title=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;bm_description=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;T=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;title=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;title=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Getting+Started+with+the+MongoDB+C%23+Driver+@+http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/&amp;t=Getting+Started+with+the+MongoDB+C%23+Driver" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/20/getting-started-with-the-mongodb-c-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSMS Template Explorer (Snippets)</title>
		<link>http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/</link>
		<comments>http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 04:25:54 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1198</guid>
		<description><![CDATA[I sometimes see people miss this. A very resourceful feature is the Template Explorer in SQL Server Management Studio. Here&#8217;s how to take advantage of it:
1. First you show the panel in SQL Server:

2. Double click on the snippet/template. We’ll double click on the Create Multi-statement table-value Function:

3. After you do so, it’ll open up [...]]]></description>
			<content:encoded><![CDATA[<p>I sometimes see people miss this. A very resourceful feature is the Template Explorer in SQL Server Management Studio. Here&#8217;s how to take advantage of it:</p>
<p><span style="text-decoration: underline;"><strong>1.</strong></span> First you show the panel in SQL Server:<br />
<a href="http://www.shinylight.com/wp-content/uploads/2011/08/13.png"><img class="alignnone size-full wp-image-1199" title="1" src="http://www.shinylight.com/wp-content/uploads/2011/08/13.png" alt="" width="304" height="268" /></a></p>
<p><span style="text-decoration: underline;"><strong>2.</strong></span> Double click on the snippet/template. We’ll double click on the Create Multi-statement table-value Function:<br />
<a href="http://www.shinylight.com/wp-content/uploads/2011/08/22.png"><img class="alignnone size-full wp-image-1200" title="2" src="http://www.shinylight.com/wp-content/uploads/2011/08/22.png" alt="" width="241" height="478" /></a></p>
<p><span style="text-decoration: underline;"><strong>3. </strong></span>After you do so, it’ll open up a new query window with the source of the snippet.</p>
<p><span style="text-decoration: underline;"><strong>4.</strong></span> Do CTRL+SHIFT+M to fill in the parameters:</p>
<p><a href="http://www.shinylight.com/wp-content/uploads/2011/08/3.png"><img class="alignnone size-full wp-image-1201" title="3" src="http://www.shinylight.com/wp-content/uploads/2011/08/3.png" alt="" width="384" height="276" /></a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;submitHeadline=SSMS+Template+Explorer+%28Snippets%29&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;title=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;title=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;title=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;bm_description=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;T=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;title=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;title=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+SSMS+Template+Explorer+%28Snippets%29+@+http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/&amp;t=SSMS+Template+Explorer+%28Snippets%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/18/ssms-template-explorer-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checklist to Consider Before Migrating from SQL Server to NoSQL</title>
		<link>http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/</link>
		<comments>http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 04:14:35 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1193</guid>
		<description><![CDATA[Here&#8217;s a checklist of items to consider before migrating to a NoSQL db from SQL Server. If you come from SQL Server land, you may be used to these features and facilities. So before shifting over to a different world, consider if the db you&#8217;re jumping into (MongoDB, CouchDB, etc.) meets your needs by analyzing [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a checklist of items to consider before migrating to a NoSQL db from SQL Server. If you come from SQL Server land, you may be used to these features and facilities. So before shifting over to a different world, consider if the db you&#8217;re jumping into (MongoDB, CouchDB, etc.) meets your needs by analyzing these items. Keep in mind that some features may not exist in NoSQL, not because of immaturity, but because it may not apply to the nature of a NoSQL database.</p>
<p><strong>Handle Load</strong></p>
<p style="padding-left: 30px;">Compare against SQL Server:</p>
<p style="padding-left: 60px;">Reading</p>
<p style="padding-left: 60px;">Writing</p>
<p style="padding-left: 30px;">Resource Monitoring</p>
<p style="padding-left: 60px;">CPU Usage</p>
<p style="padding-left: 60px;">Memory Use</p>
<p style="padding-left: 60px;">Disk use</p>
<p><strong>Transactions</strong></p>
<p style="padding-left: 30px;">Are there software design patterns to rollback</p>
<p style="padding-left: 30px;">Locking</p>
<p style="padding-left: 30px;">Reading</p>
<p style="padding-left: 30px;">
<p><strong>Programming</strong></p>
<p style="padding-left: 30px;">Syntax</p>
<p style="padding-left: 30px;">SELECT / UPDATE / DELETE / INSERT / JOINS</p>
<p style="padding-left: 30px;">Reusable Code Modules</p>
<p style="padding-left: 60px;">Compiled Stored procs</p>
<p style="padding-left: 60px;">Functions</p>
<p style="padding-left: 60px;">Custom Data Types</p>
<p style="padding-left: 30px;">Dynamic Management Views</p>
<p style="padding-left: 30px;">Indexing</p>
<p style="padding-left: 60px;">Clustered</p>
<p style="padding-left: 60px;">Non-Clustered</p>
<p><strong>Toolset / Resources</strong></p>
<p style="padding-left: 30px;">IDE</p>
<p style="padding-left: 30px;">Administration</p>
<p style="padding-left: 30px;">Profiler</p>
<p style="padding-left: 30px;">Excution Planner</p>
<p style="padding-left: 30px;">Community</p>
<p style="padding-left: 30px;">Books</p>
<p><strong>Administration</strong></p>
<p style="padding-left: 30px;">Complexity</p>
<p style="padding-left: 30px;">Backing up</p>
<p style="padding-left: 60px;">Full</p>
<p style="padding-left: 60px;">Differentials</p>
<p style="padding-left: 60px;">Transaction Log</p>
<p style="padding-left: 30px;">Recovery</p>
<p style="padding-left: 30px;">Replication / Clustering</p>
<p style="padding-left: 30px;">Snapshots</p>
<p><strong>Security</strong></p>
<p><strong>C# Integration</strong></p>
<p><strong>Facilities</strong></p>
<p style="padding-left: 30px;">Full Text Search</p>
<p style="padding-left: 30px;">Snapshots</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;submitHeadline=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;title=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;title=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;title=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;bm_description=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;T=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;title=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;title=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL+@+http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/&amp;t=Checklist+to+Consider+Before+Migrating+from+SQL+Server+to+NoSQL" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/18/checklist-to-consider-before-migrating-from-sql-server-to-nosql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kooboo CMS First Impressions</title>
		<link>http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/</link>
		<comments>http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:57:08 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1189</guid>
		<description><![CDATA[Kooboo is a CMS based on ASP.NET MVC. Recently, I got a chance to take it for a spin, and here are some of my thoughts. Keep in mind that the drawbacks here may come just from my ignorance of the tool use.   I&#8217;ll update this as the more I learn about the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.kooboo.com/">Kooboo</a> is a CMS based on ASP.NET MVC. Recently, I got a chance to take it for a spin, and here are some of my thoughts. Keep in mind that the drawbacks here may come just from my ignorance of the tool use. <img src='http://www.shinylight.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;ll update this as the more I learn about the inner workings.</p>
<p><strong>Benefits </strong></p>
<ul>
<li>Admin Panel’s UI is intuitive for designers/programmers
<ul>
<li>Easy to add pages</li>
<li>Easy to add your own themes/styles</li>
<li>Easy to create your own type of content</li>
<li>Easy to add content</li>
</ul>
</li>
<li>Lots of Features, more than Orchard</li>
<li>Mature, has been around for a while (2008)</li>
<li>Views are coded in Razor</li>
<li>Can connect to MongoDB and other datasource types</li>
<li>Versioning of any piece of content and view differences</li>
<li>Manage website resources easily – images/documents/etc.</li>
</ul>
<p><strong>Drawbacks</strong></p>
<p>May not be a drawback once I figure out the “how” and get better understanding.</p>
<ul>
<li>Once a site is created, when I migrated from XML to MongoDB, I lost all the website data from the XML files.</li>
<li>Admin Panel’s UI may not be intuitive to non-designers/programmers.</li>
<li>Site directory structure Kooboo generates is not the same as the traditional ASP.NET MVC.</li>
</ul>
<p>Let’s take a look. For a site I created using Kooboo, named “batman”:</p>
<p><a href="http://www.shinylight.com/wp-content/uploads/2011/08/12.png"><img class="alignnone size-full wp-image-1190" title="1" src="http://www.shinylight.com/wp-content/uploads/2011/08/12.png" alt="" width="537" height="355" /></a></p>
<ul>
<li>When a content type is created, it does not create a C# class file. (I didn’t see one at least, in the directory structure.) It does, however, create a MongoDB collection for the content, there’s just no C# class mapped to it.</li>
<li>There’s no clear way to bind a View to a model class as in traditional ASP.NET MVC since, Kooboo doesn’t create a C# class file. It doesn’t follow the traditional file/folder naming convention: for each View, you map that to a model.</li>
<li>Community not as large as other CMS communities (Orchard, Umbraco, DNN).</li>
</ul>
<p>I’ll keep exploring, but this is what I’ve found so far.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;submitHeadline=Kooboo+CMS+First+Impressions&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;title=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;title=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;title=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;bm_description=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;T=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;title=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;title=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Kooboo+CMS+First+Impressions+@+http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/&amp;t=Kooboo+CMS+First+Impressions" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/18/kooboo-cms-first-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kooboo Setup Notes</title>
		<link>http://www.shinylight.com/2011/08/18/kooboo-setup-notes/</link>
		<comments>http://www.shinylight.com/2011/08/18/kooboo-setup-notes/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:47:51 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1187</guid>
		<description><![CDATA[I had to apply these settings to make Kooboo work on my machine connecting to MongoDB on my VM:
In Web.config:
For the MongoDB.config (when you follow the instructions to set it up http://www.kooboo.com/Documents/Detail/CMS/v3/MSSQL-SQLCE-RavenDB-and-MongoDB ), I copied it to:
Kooboo_CMS/
And you may have to copy it to C:\kooboo\Kooboo_CMS\Kooboo_CMS\bin as well. (my installation was a little flaky)
You’ll have to [...]]]></description>
			<content:encoded><![CDATA[<p>I had to apply these settings to make Kooboo work on my machine connecting to MongoDB on my VM:</p>
<p>In Web.config:</p>
<p>For the MongoDB.config (when you follow the instructions to set it up http://www.kooboo.com/Documents/Detail/CMS/v3/MSSQL-SQLCE-RavenDB-and-MongoDB ), I copied it to:</p>
<p>Kooboo_CMS/</p>
<p>And you may have to copy it to C:\kooboo\Kooboo_CMS\Kooboo_CMS\bin as well. (my installation was a little flaky)</p>
<p>You’ll have to build the project (in VS2010) if you already ran the site (the default data store is XML files).</p>
<p>When all is set and done, make sure that the db was created on MongoDB. In this case, it created the db samplesite.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;submitHeadline=Kooboo+Setup+Notes&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;title=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;title=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;title=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;bm_description=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;T=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;title=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;title=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Kooboo+Setup+Notes+@+http://www.shinylight.com/2011/08/18/kooboo-setup-notes/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/18/kooboo-setup-notes/&amp;t=Kooboo+Setup+Notes" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/18/kooboo-setup-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validating Checkboxes in ASP.NET MVC</title>
		<link>http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/</link>
		<comments>http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:44:15 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Databases]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1182</guid>
		<description><![CDATA[So here&#8217;s a very barebones example that does validation to all the checkboxes on a page. Also, it does the following:

Maps the checkboxes to a dictionary object.
Creates a custom model binder (that maps the checkbox values to the dictionary object).


Let&#8217;s get started.

The Model

public class Event
&#123;
  public string Name &#123; get; set; &#125;
  public [...]]]></description>
			<content:encoded><![CDATA[<p>So here&#8217;s a very barebones example that does validation to all the checkboxes on a page. Also, it does the following:</p>
<ul>
<li>Maps the checkboxes to a dictionary object.</li>
<li>Creates a custom model binder (that maps the checkbox values to the dictionary object).</li>
</ul>
<p><img class="alignnone size-full wp-image-1183" title="1" src="http://www.shinylight.com/wp-content/uploads/2011/08/11.png" alt="" width="490" height="301" /></p>
<p>Let&#8217;s get started.</p>
<p><a href="http://www.shinylight.com/wp-content/uploads/2011/08/21.png"><img class="alignnone size-full wp-image-1184" title="2" src="http://www.shinylight.com/wp-content/uploads/2011/08/21.png" alt="" width="293" height="387" /></a></p>
<h3>The Model</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> <span style="color: #0600FF;">Event</span>
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #0600FF;">public</span> Dictionary Weekdays <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<h3>The Custom Model Binder</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> EventBinder <span style="color: #008000;">:</span> IModelBinder
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">object</span> BindModel<span style="color: #000000;">&#40;</span>ControllerContext controllerContext, ModelBindingContext bindingContext<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #0600FF;">Event</span> ev <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #0600FF;">Event</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>      
&nbsp;
      ev.<span style="color: #0000FF;">Name</span> <span style="color: #008000;">=</span> controllerContext.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Name&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #008080; font-style: italic;">// Let's initialize all the keys to false</span>
      ev.<span style="color: #0000FF;">Weekdays</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Monday&quot;</span>, <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Tuesday&quot;</span>, <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Wednesday&quot;</span>, <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Thursday&quot;</span>, <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Friday&quot;</span>, <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
      <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>      
&nbsp;
      <span style="color: #008080; font-style: italic;">// Now let's trigger to true when the checkbox is checked.</span>
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>controllerContext.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Weekdays[Monday]&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;on&quot;</span><span style="color: #000000;">&#41;</span>
        ev.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Monday&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>controllerContext.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Weekdays[Tuesday]&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;on&quot;</span><span style="color: #000000;">&#41;</span>
        ev.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Tuesday&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>controllerContext.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Weekdays[Wednesday]&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;on&quot;</span><span style="color: #000000;">&#41;</span>
        ev.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Wednesday&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>controllerContext.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Weekdays[Thursday]&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;on&quot;</span><span style="color: #000000;">&#41;</span>
        ev.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Thursday&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>controllerContext.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Request</span>.<span style="color: #0000FF;">Form</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Weekdays[Friday]&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;on&quot;</span><span style="color: #000000;">&#41;</span>
        ev.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Friday&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">return</span> ev<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span></pre></div></div>

<h3>The Controller</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Web</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Web.Mvc</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">MvcApplication6.Models</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> MvcApplication6.<span style="color: #0000FF;">Controllers</span>
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> HomeController <span style="color: #008000;">:</span> Controller
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> ActionResult Index<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #008080; font-style: italic;">// We need to instantiate an event object before setting the checkboxes to default.</span>
      <span style="color: #0600FF;">Event</span> e <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #0600FF;">Event</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>      
&nbsp;
      <span style="color: #008080; font-style: italic;">// Let's initialize the checkboxes.</span>
      e.<span style="color: #0000FF;">Weekdays</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Monday&quot;</span>,    <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Tuesday&quot;</span>,   <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Wednesday&quot;</span>, <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Thursday&quot;</span>,  <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
        <span style="color: #000000;">&#123;</span><span style="color: #666666;">&quot;Friday&quot;</span>,    <span style="color: #0600FF;">false</span> <span style="color: #000000;">&#125;</span>,
      <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
      ViewBag.<span style="color: #0000FF;">IsFormValid</span> <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">return</span> View<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Home&quot;</span>, e<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #000000;">&#91;</span>HttpPost<span style="color: #000000;">&#93;</span>
    <span style="color: #0600FF;">public</span> ActionResult Index<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>ModelBinder<span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>EventBinder<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #0600FF;">Event</span> e<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #008080; font-style: italic;">// Let's validate the name.</span>
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #0000FF;">Name</span>.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        ModelState.<span style="color: #0000FF;">AddModelError</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Name&quot;</span>, <span style="color: #666666;">&quot;First name is required.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #000000;">&#125;</span>
&nbsp;
      <span style="color: #008080; font-style: italic;">// Validate the checkbox. Make sure they are all checked.</span>
      <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>var day <span style="color: #0600FF;">in</span> e.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>day.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
          ModelState.<span style="color: #0000FF;">AddModelError</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Weekdays[&quot;</span> <span style="color: #008000;">+</span> day.<span style="color: #0000FF;">Key</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;]&quot;</span>, day.<span style="color: #0000FF;">Key</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; has to be checked!&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
      <span style="color: #000000;">&#125;</span>
&nbsp;
      ViewBag.<span style="color: #0000FF;">IsFormValid</span> <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
&nbsp;
      <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ModelState.<span style="color: #0000FF;">IsValid</span><span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
        ViewBag.<span style="color: #0000FF;">IsFormValid</span> <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
      <span style="color: #000000;">&#125;</span>        
&nbsp;
      <span style="color: #0600FF;">return</span> View<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Home&quot;</span>, e<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<h3>The View</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">@model MvcApplication6.<span style="color: #0000FF;">Models</span>.<span style="color: #0600FF;">Event</span>
@<span style="color: #000000;">&#123;</span>
  Layout <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&lt;!--</span>
    .<span style="color: #0000FF;">formErrors</span>
    <span style="color: #000000;">&#123;</span>
      color<span style="color: #008000;">:</span> Red<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">--&gt;</span>
<span style="color: #008000;">&lt;</span>div<span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;</span>h1<span style="color: #008000;">&gt;</span>Form <span style="color: #008000;">Is</span><span style="color: #008000;">:</span> <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;&amp;</span>lt<span style="color: #008000;">;</span> @ViewBag.<span style="color: #0000FF;">IsFormValid</span> <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;&amp;</span>gt<span style="color: #008000;">;&lt;/</span>h1<span style="color: #008000;">&gt;</span>
<span style="color: #008000;">&lt;</span>h4<span style="color: #008000;">&gt;</span>Fill <span style="color: #0600FF;">out</span> the name and check every checkbox so the form becomes <span style="color: #0600FF;">true</span> <span style="color: #000000;">&#40;</span>valid<span style="color: #000000;">&#41;</span>.<span style="color: #008000;">&lt;/</span>h4<span style="color: #008000;">&gt;</span>
@<span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>@Html.<span style="color: #0000FF;">BeginForm</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Index&quot;</span>, <span style="color: #666666;">&quot;Home&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #008080; font-style: italic;">// FirstName TextBox</span>
      @Html.<span style="color: #0000FF;">LabelFor</span><span style="color: #000000;">&#40;</span>model <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> model.<span style="color: #0000FF;">Name</span>, <span style="color: #666666;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>
      @Html.<span style="color: #0000FF;">TextBoxFor</span><span style="color: #000000;">&#40;</span>model <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> model.<span style="color: #0000FF;">Name</span>, <span style="color: #666666;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>
      @Html.<span style="color: #0000FF;">ValidationMessageFor</span><span style="color: #000000;">&#40;</span>model <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> model.<span style="color: #0000FF;">Name</span>, <span style="color: #0600FF;">null</span>, <span style="color: #008000;">new</span> <span style="color: #000000;">&#123;</span> @<span style="color: #FF0000;">class</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;formErrors&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>   
<span style="color: #008000;">&lt;</span>hr <span style="color: #008000;">/&gt;</span>
&nbsp;
      <span style="color: #008080; font-style: italic;">// Weekday Checkboxes</span>
      <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>var day <span style="color: #0600FF;">in</span> Model.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#41;</span>
      <span style="color: #000000;">&#123;</span>
<span style="color: #008000;">&lt;</span>input name<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Weekdays[@day.Key]&quot;</span> type<span style="color: #008000;">=</span><span style="color: #666666;">&quot;checkbox&quot;</span> <span style="color: #008000;">/&gt;</span> <span style="color: #008000;">checked</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;checked&quot;</span> 
        <span style="color: #000000;">&#125;</span>
        <span style="color: #008000;">/&amp;</span>gt<span style="color: #008000;">;</span> @day.<span style="color: #0000FF;">Key</span>
&nbsp;
        @Html.<span style="color: #0000FF;">ValidationMessageFor</span><span style="color: #000000;">&#40;</span>model <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> model.<span style="color: #0000FF;">Weekdays</span><span style="color: #000000;">&#91;</span>day.<span style="color: #0000FF;">Key</span><span style="color: #000000;">&#93;</span>, <span style="color: #0600FF;">null</span>, <span style="color: #008000;">new</span> <span style="color: #000000;">&#123;</span>@<span style="color: #FF0000;">class</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;formErrors&quot;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>
&nbsp;
      <span style="color: #000000;">&#125;</span>      
<span style="color: #008000;">&lt;</span>input type<span style="color: #008000;">=</span><span style="color: #666666;">&quot;submit&quot;</span> value<span style="color: #008000;">=</span><span style="color: #666666;">&quot;submit me&quot;</span> <span style="color: #008000;">/&gt;</span>
    <span style="color: #000000;">&#125;</span><span style="color: #008000;">&lt;/</span>div<span style="color: #008000;">&gt;</span></pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;submitHeadline=Validating+Checkboxes+in+ASP.NET+MVC&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;title=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;title=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;title=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;bm_description=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;T=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;title=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;title=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Validating+Checkboxes+in+ASP.NET+MVC+@+http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/&amp;t=Validating+Checkboxes+in+ASP.NET+MVC" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/18/validating-checkboxes-in-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to SQL Server 2008 (Part II)</title>
		<link>http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/</link>
		<comments>http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:23:42 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1175</guid>
		<description><![CDATA[Sometime ago, I published some tips on upgrading to 2008. Here are some additional notes to keep in mind.
For upgrading, my plan of attack in the past has been as follows:
1. Run the Upgrade Advisor on all the databases (this doesn’t require much effort, just download, install, point to the db and run)
2. On production, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime ago, I published some tips on <a href="http://www.shinylight.com/2009/09/18/upgrading-from-sql-server-2000-to-2008/">upgrading to 2008</a>. Here are some additional notes to keep in mind.</p>
<p>For upgrading, my plan of attack in the past has been as follows:</p>
<p><span style="text-decoration: underline;"><strong>1.</strong></span> Run the Upgrade Advisor on all the databases (this doesn’t require much effort, just download, install, point to the db and run)</p>
<p><span style="text-decoration: underline;"><strong>2.</strong></span> On production, do a custom install and only install what you need. You can do a side-by-side install and have SQL Server 2008 installed while SQL Server 2000 exists on the same server.</p>
<p><span style="text-decoration: underline;"><strong>3.</strong></span> Analyze the Advisor’s reports and refactor where SQL objects that need to be refactored</p>
<p><span style="text-decoration: underline;"><strong>4.</strong></span> Refactor TSQL as needed</p>
<p><span style="text-decoration: underline;"><strong>5.</strong></span> Now, TSQL isn’t just in the DBs, it may also exists in the app code and other web files (.aspx, etc.). This is where it gets more challenging. Check to make sure if the analyzer can open .trc files. If so, run SQL Server profiler while the site is being used and those queries are being run. Then open that .trc file in the analyzer so it can check the validity.</p>
<p>If this doesn’t work, log the profiler results to a table. Then put the TSQL from output of the profiler in a sproc. Point the analyzer to that sproc to check the syntax.</p>
<p>You can automate this task by using Selenium or write a script using WGET to fetch and look for 500 HTTP error codes.</p>
<p><span style="text-decoration: underline;"><strong>6.</strong></span> Refactor TSQL as needed.</p>
<p><span style="text-decoration: underline;"><strong>7.</strong></span> Test the websites with 2008. Ideally you want to start testing with the latest compatibility. Having a lesser level of compatibility causes more overhead (since it has to support older features) and can allow the use of deprecated features that MS will abandon in the next release.</p>
<p><span style="text-decoration: underline;"><strong>9.</strong></span> Optimize the settings for db server. Strip out all dbs you don’t need to avoid security problems, like: Northwind, AdventureWorks.</p>
<p><span style="text-decoration: underline;"><strong>10.</strong></span> Before pushing it live, make sure you backup all dbs, including all system dbs.</p>
<p><span style="text-decoration: underline;"><strong>11.</strong></span> As soon as the switch is flipped, keep an eye out on perform/SSMS monitor. Have handy the appropriate DMVs to monitor.</p>
<p><span style="text-decoration: underline;"><strong>12.</strong></span> Even if the application(s) did not throw errors while testing on dev, there’s a chance that once you go to production, it starts throwing errors due to compatibility (maybe the more obscure pages were not tested). Be ready to flip the compatibility mode to 2000 – this takes place instantly.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;submitHeadline=Upgrading+to+SQL+Server+2008+%28Part+II%29&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;title=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;title=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;title=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;bm_description=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;T=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;title=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;title=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Upgrading+to+SQL+Server+2008+%28Part+II%29+@+http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/&amp;t=Upgrading+to+SQL+Server+2008+%28Part+II%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/18/upgrading-to-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NULLs in MongoDB</title>
		<link>http://www.shinylight.com/2011/08/10/nulls-in-mongodb/</link>
		<comments>http://www.shinylight.com/2011/08/10/nulls-in-mongodb/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 19:14:42 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1170</guid>
		<description><![CDATA[By default, the C# driver’s serializer takes a null value and assigns a default, rather than just writing the word NULL in the collection when inserting. 
So if you had a an object that had 50 properties, only set 1 value in it, and passed it to MongoDB, it would insert all 50 properties, which [...]]]></description>
			<content:encoded><![CDATA[<p>By default, the C# driver’s serializer takes a null value and assigns a default, rather than just writing the word NULL in the collection when inserting. </p>
<p>So if you had a an object that had 50 properties, only set 1 value in it, and passed it to MongoDB, it would insert all 50 properties, which would be wasteful (depending on how you looked at it).</p>
<p>One can decorate the property with the [BsonIgnoreIfNull] attribute and will not write that element to the db if it’s null. However, if you don’t always want to use this property, one can set it once (and forget it) by creating a MongoDB “ConventionProfile” across the entire application. We have this setup in the Global.asax.cs so it gets created when the application is loaded:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">var profile <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ConventionProfile<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
profile.<span style="color: #0000FF;">SetIgnoreIfNullConvention</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> AlwaysIgnoreIfNullConvention<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
BsonClassMap.<span style="color: #0000FF;">RegisterConventions</span><span style="color: #000000;">&#40;</span>profile, t <span style="color: #008000;">=&gt;</span> <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>However, even with that, it only appears that it does this only for strings that are null. If you have a property that’s Boolean, Integer, or Date, it will still write the elements to the database, setting Booleans to Falses, Integers to 0, and Dates to an ISO timestamp. It does this partly because these data types don’t implement a NULL property, so they can’t be null. To “make” them NULL, you have to use the question mark after the data type, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">bool</span><span style="color: #008000;">?</span> IsEnabled<span style="color: #008000;">;</span>
<span style="color: #FF0000;">int</span><span style="color: #008000;">?</span> MagicNumber<span style="color: #008000;">;</span>
Date<span style="color: #008000;">?</span> TimeStamp<span style="color: #008000;">;</span></pre></div></div>

<p>All three are short for:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Nullable<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">bool</span><span style="color: #008000;">&gt;</span> isEnabled<span style="color: #008000;">;</span>
Nullable<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span> MagicNumber<span style="color: #008000;">;</span>
Nullable<span style="color: #008000;">&lt;</span>Date<span style="color: #008000;">&gt;</span> TimeStamp<span style="color: #008000;">;</span></pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;submitHeadline=NULLs+in+MongoDB&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;title=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;title=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;title=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;bm_description=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;T=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;title=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;title=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+NULLs+in+MongoDB+@+http://www.shinylight.com/2011/08/10/nulls-in-mongodb/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/10/nulls-in-mongodb/&amp;t=NULLs+in+MongoDB" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/10/nulls-in-mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Renaming a SQL Server Table (Watch Out)</title>
		<link>http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/</link>
		<comments>http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 19:10:36 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shinylight.com/?p=1166</guid>
		<description><![CDATA[Sometimes while testing on your local db, one has the habit (I admit to have this in the past) of renaming a table before replacing it. One does this as a quick backup. The problem with this strategy is that it doesn&#8217;t rename all of the dependencies. For example, if you had a table formsClients [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes while testing on your local db, one has the habit (I admit to have this in the past) of renaming a table before replacing it. One does this as a quick backup. The problem with this strategy is that it doesn&#8217;t rename all of the dependencies. For example, if you had a table formsClients and renamed it formsClients_old, and then restored the formsClients table again (let&#8217;s say from an SSIS import), you&#8217;ll get something like this:</p>
<p><img src="http://www.shinylight.com/wp-content/uploads/2011/08/1.png" alt="" title="1" width="614" height="101" class="alignnone size-full wp-image-1167" /></p>
<p>If we inspect the dependencies, we&#8217;ll see that in this case, it&#8217;s a foreign key constraint:</p>
<p><img src="http://www.shinylight.com/wp-content/uploads/2011/08/2.png" alt="" title="2" width="323" height="360" class="alignnone size-full wp-image-1168" /></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em></em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;submitHeadline=Renaming+a+SQL+Server+Table+%28Watch+Out%29&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;title=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;title=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;title=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;bm_description=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;T=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;title=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;title=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Renaming+a+SQL+Server+Table+%28Watch+Out%29+@+http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/&amp;t=Renaming+a+SQL+Server+Table+%28Watch+Out%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.shinylight.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.shinylight.com/2011/08/10/renaming-a-sql-server-table-watch-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

