<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Code Capers</title>
    <description>The Ninja Coding Dojo</description>
    <link>http://www.codecapers.com/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 2.0.0.36</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://www.codecapers.com/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Michael Ceranski</dc:creator>
    <dc:title>Code Capers</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/codecapers" /><feedburner:info uri="codecapers" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.0/</creativeCommons:license><item>
      <title>Getting Started With The Arduino</title>
      <description>&lt;p&gt;As an engineer, I constantly feel the need to learn new things in order to keep the &lt;a href="http://www.codinghorror.com/blog/2009/03/sharpening-the-saw.html" target="_blank"&gt;"saw sharp"&lt;/a&gt;. Since I write code for a living, I often feel dissatisfied by the notion that everything I create is "virtual". The only way to interact with the things that I create are with a keyboard and mouse. The thought of this often makes me wonder if I would have been happier in a profession where I built things with my hands. People tend to appreciate things more that they can hold and physically interact with. So naturally, this led me to the idea of "How can I make software take on a more physical presence?". Of course I immediately thought of robotics, so I typed the term "robotics" into Google and I discovered the term "Physical Computing". According to Wikipedia, the definition of physical computing is:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Physical computing, in the broadest sense, means building interactive physical systems by the use of software and hardware that can sense and respond to the analog world. While this definition is broad enough to encompass things such as smart automotive traffic control systems or factory automation processes, it is not commonly used to describe them. In the broad sense, physical computing is a creative framework for understanding human beings' relationship to the digital world. In practical use, the term most often describes handmade art, design or DIY hobby projects that use sensors and microcontrollers to translate analog input to a software system, and/or control electro-mechanical devices such as motors, servos, lighting or other hardware.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Immediately after reading about physical computing I was intrigued by the idea so I decided to learn more about the different kinds of microcontroller that are available on the market. Of course, since I am a .NET Developer I already knew about the &lt;a href="http://netduino.com/"&gt;Netduino&lt;/a&gt;. The Netduino is a microcontroller that runs the .NET micro framework and you can use Visual Studio to create sketches. Although this sounded cool I decided that 40+ hours a week in Visual Studio is more than enough for me. Therefore, I opted to go with the Arduino platform instead. The Arduino programming language is a implementation of &lt;a href="http://en.wikipedia.org/wiki/Wiring_(development_platform)" target="_blank"&gt;Wiring&lt;/a&gt;, a physical computing platform, which is based on the &lt;a href="http://processing.org/" target="_blank"&gt;Processing multimedia programming environment&lt;/a&gt;. With the combination of some basic electronics skills and the Arduino you can create almost anything. If you search online you will find all kinds of Arduino based projects which include clocks, weather stations, robots and even 3d printers! To make a long story short I ended up ordering the &lt;a href="http://www.sparkfun.com/products/10173" target="_blank"&gt;SparkFun inventor's kit&lt;/a&gt;. The kit includes an Arduino Uno R3, some basic components and a step-by-step guide on how to use each one. If you are starting from scratch like me and you have no prior experience with electronics then I strongly recommend buying a kit. The manual that comes with the SparkFun Kit is very well done and of course there are a large community of Arduino developers willing to help if you get stuck.&lt;/p&gt;
&lt;p&gt;&lt;img title="=&amp;quot;The" src="http://www.codecapers.com/image.axd?picture=2012%2f1%2fSIK.jpg" alt="The SparkFun Inventors Kit" /&gt;&lt;/p&gt;
&lt;p&gt;After you make it through all the tutorials in the kit you will probably lay awake at night just thinking of the possibilities. In addition, you will probably drop some cash because on a bigger breadboard, a multimeter and a soldering station. Anyways, just to whet your appetite here are some examples of things that you can do with an Arduino:&lt;/p&gt;
&lt;p&gt;RGB LEDs controlled by an Arduino and sequenced with Flash.&lt;/p&gt;
&lt;p&gt;
&lt;object style="height: 390px; width: 640px;" width="640" height="360"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/caSJI7QkxDM?version=3&amp;amp;feature=player_detailpage" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed type="application/x-shockwave-flash" width="640" height="360" src="http://www.youtube.com/v/caSJI7QkxDM?version=3&amp;amp;feature=player_detailpage" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;Arduino Robot using a Adafruit motor shield, 2x Sharp IR sensors, one PING sensor and an XPAL XP8000 battery.&lt;/p&gt;
&lt;p&gt;
&lt;object style="height: 390px; width: 640px;" width="640" height="360"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/R8vPu7YpqlI?version=3&amp;amp;feature=player_detailpage" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed type="application/x-shockwave-flash" width="640" height="360" src="http://www.youtube.com/v/R8vPu7YpqlI?version=3&amp;amp;feature=player_detailpage" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;And finally, a &lt;a href="http://wiki.makerbot.com/thingomatic" target="_blank"&gt;3D Printer&lt;/a&gt; from MakerBot. Yes, I said 3D Printer! Apparently, this uses a Arduino MEGA under the covers.&lt;br /&gt; 
&lt;object style="height: 390px; width: 640px;" width="640" height="360"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/OzvCqc2jTX8?version=3&amp;amp;feature=player_detailpage" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed type="application/x-shockwave-flash" width="640" height="360" src="http://www.youtube.com/v/OzvCqc2jTX8?version=3&amp;amp;feature=player_detailpage" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;In the upcoming months you can expect to see some Arduino and electronics based articles appearing on my blog. Perhaps even an article about how I built my first robot!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PAHWp-Dy9NVyV4cvfKeZcfD95RY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PAHWp-Dy9NVyV4cvfKeZcfD95RY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PAHWp-Dy9NVyV4cvfKeZcfD95RY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PAHWp-Dy9NVyV4cvfKeZcfD95RY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=C5kDDGHfVLM:qpJJrbZYJy4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=C5kDDGHfVLM:qpJJrbZYJy4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=C5kDDGHfVLM:qpJJrbZYJy4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=C5kDDGHfVLM:qpJJrbZYJy4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=C5kDDGHfVLM:qpJJrbZYJy4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=C5kDDGHfVLM:qpJJrbZYJy4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=C5kDDGHfVLM:qpJJrbZYJy4:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/C5kDDGHfVLM" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/C5kDDGHfVLM/post.aspx</link>
      <comments>http://www.codecapers.com/post/Getting-Started-With-The-Arduino.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=5f976e71-1736-4eae-949a-4b7bcbd26fc3</guid>
      <pubDate>Tue, 31 Jan 2012 09:21:00 -0200</pubDate>
      <category>Arduino</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=5f976e71-1736-4eae-949a-4b7bcbd26fc3</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=5f976e71-1736-4eae-949a-4b7bcbd26fc3</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/Getting-Started-With-The-Arduino.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=5f976e71-1736-4eae-949a-4b7bcbd26fc3</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=5f976e71-1736-4eae-949a-4b7bcbd26fc3</feedburner:origLink></item>
    <item>
      <title>Getting Assembly Information Using Reflection</title>
      <description>&lt;p&gt;I recently took over a WPF application that needed a little bit of refactoring. One of the places that had a lot of repeated code was the about screen. By using reflection a bunch of properties were being created to display things like the assembly title, version, description and etcetera. The original code looked like this:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public string AssemblyDescription
{
    get
    {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
        if (attributes.Length == 0)
        {
            return &amp;quot;&amp;quot;;
        }
        return ((AssemblyDescriptionAttribute)attributes[0]).Description;
    }
}

public string AssemblyProduct
{
    get
    {
        object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
        if (attributes.Length == 0)
        {
            return &amp;quot;&amp;quot;;
        }
        return ((AssemblyProductAttribute)attributes[0]).Product;
    }
}&lt;/pre&gt;

&lt;p&gt;You may have noticed that this code does not follow the &lt;a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself" target="_blank"&gt;DRY&lt;/a&gt; principle. In case you arent familiar with the term, DRY stands for Don't repeat yourself. In otherwords, if you repeat the same code multiple times then you should try to refactor it into a more generic method. &lt;/p&gt;

&lt;p&gt;After analyzing the code you may notice that both of the property getters do the same thing. First, it gets a handle to the current assembly. Next, the GetCustomAttributes method is called to get an object array which contains all the attribute values for a given type. Finally, a little bit of conditional logic is used to emit a value. Using the power of generics and some reflection we can easily build an extension method that will eliminate the redundant code. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Warning: If you are not familiar with generics, reflection and lambda statements then the following code may cause your brain to explode&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public static TAttribute[] GetAttributes&amp;lt;TAttribute&amp;gt;(this Assembly assembly) where TAttribute : Attribute {
    return assembly.GetCustomAttributes(typeof(TAttribute), false) as TAttribute[];
}

public static object GetFirstAttributeValue&amp;lt;TAttribute&amp;gt;(
    this Assembly assembly,
    Expression&amp;lt;Func&amp;lt;TAttribute, object&amp;gt;&amp;gt; propertyLambda) where TAttribute : Attribute {
    Type type = typeof(TAttribute);

    var attributeValues = assembly.GetAttributes&amp;lt;TAttribute&amp;gt;();
    if (attributeValues.Length == 0)
        throw new ArgumentException(&amp;quot;No values found&amp;quot;);

    var member = propertyLambda.Body as MemberExpression;
    if (member == null)
        throw new ArgumentException(string.Format(&amp;quot;Expression '{0}' refers to a method, not a property.&amp;quot;, propertyLambda));

    var propInfo = member.Member as PropertyInfo;
    if (propInfo == null)
        throw new ArgumentException(string.Format(&amp;quot;Expression '{0}' refers to a field, not a property.&amp;quot;, propertyLambda));

    if (type != propInfo.ReflectedType &amp;amp;&amp;amp; !type.IsSubclassOf(propInfo.ReflectedType))
        throw new ArgumentException(string.Format(&amp;quot;Expresion '{0}' refers to a property that is not from type {1}.&amp;quot;, propertyLambda, type));

    var firstValue = attributeValues[0];
    return propInfo.GetValue(firstValue, null);
}&lt;/pre&gt;

&lt;p&gt;The code above basically takes the lambda statement, makes sure its a property expression and then uses reflection to get the value of the object. By the way, I do not take credit for writing the reflection code, most of it was borrowed from this &lt;a href="http://stackoverflow.com/questions/671968/retrieving-property-name-from-lambda-expression" target="_blank"&gt;stackoverflow post&lt;/a&gt;. In any case, with the help of the extension method above we can now simplify our code as:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;private Assembly Assembly { get; set; }

public AboutViewModel()
{
    Assembly = Assembly.GetExecutingAssembly();
}

public string AssemblyDescription {
    get {
        return Assembly.GetFirstAttributeValue&amp;lt;AssemblyDescriptionAttribute&amp;gt;(x =&amp;gt; x.Description).ToString();
    }
}

public string AssemblyProduct {
    get {
        return Assembly.GetFirstAttributeValue&amp;lt;AssemblyProductAttribute&amp;gt;(x =&amp;gt; x.Product).ToString();
    }
}&lt;/pre&gt;

&lt;p&gt;As you can see, the code is much cleaner. Also take notice that I cached the call to Assembly.GetExecutingAssembly() in a private variable. This helps with performance and also cleans up the code a little. &lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/aYnoEXAzwQeDg0fATuGwAEJFB8I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aYnoEXAzwQeDg0fATuGwAEJFB8I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/aYnoEXAzwQeDg0fATuGwAEJFB8I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aYnoEXAzwQeDg0fATuGwAEJFB8I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=Fr1EkCfueUY:ow8guqXA69c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=Fr1EkCfueUY:ow8guqXA69c:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=Fr1EkCfueUY:ow8guqXA69c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=Fr1EkCfueUY:ow8guqXA69c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=Fr1EkCfueUY:ow8guqXA69c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=Fr1EkCfueUY:ow8guqXA69c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=Fr1EkCfueUY:ow8guqXA69c:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/Fr1EkCfueUY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/Fr1EkCfueUY/post.aspx</link>
      <comments>http://www.codecapers.com/post/Getting-Assembly-Information-Using-Reflection.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=6f077a96-9eaf-4467-b1d0-0a219cbe6c29</guid>
      <pubDate>Tue, 03 Jan 2012 17:37:47 -0200</pubDate>
      <category>MVVM</category>
      <category>dotNet</category>
      <category>WPF</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=6f077a96-9eaf-4467-b1d0-0a219cbe6c29</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=6f077a96-9eaf-4467-b1d0-0a219cbe6c29</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/Getting-Assembly-Information-Using-Reflection.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=6f077a96-9eaf-4467-b1d0-0a219cbe6c29</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=6f077a96-9eaf-4467-b1d0-0a219cbe6c29</feedburner:origLink></item>
    <item>
      <title>Using Ninject with MVVM Light</title>
      <description>&lt;p&gt;I recently changed jobs and as a result I find myself trying to draw parallels between the ASP.NET MVC development I used to do and the WPF MVVM projects that I am working on now. After spending a couple of weeks reading about WPF and learning the fundamentals I finally sat down to write my first WPF application. I chose &lt;a href="http://www.galasoft.ch/mvvm/#intro" target="_blank"&gt;MVVM Light&lt;/a&gt; as my framework because I felt it had a short learning curve and it was fairly lightweight when compared to some of the other frameworks that are out there. &lt;/p&gt;  &lt;p&gt;As a MVC developer, one of my favorite &lt;a href="http://nuget.org/" target="_blank"&gt;NuGet&lt;/a&gt; packages has always been &lt;a href="http://www.ninject.org" target="_blank"&gt;Ninject&lt;/a&gt;. Adding Ninject to an MVC application is extremely simple because there is a MVC specific implementation called Ninject.MVC which takes care of all the bootstrapping for you. Once you add the package to your MVC project you simply setup your bindings and your up and running. However, I found myself a little bit confused when I added Ninject to my MVVM Light application. I wasn’t sure how to bootstrap Ninject into the application and since there is no WPF specific version of Ninject I knew I had to do the work myself. However, after a little bit of research I came up with the following solution.&lt;/p&gt;  &lt;h2&gt;Step 1. Create your Ninject Modules&lt;/h2&gt;  &lt;p&gt;The NinjectModule class is the easiest way to get your bindings registered. You may have noticed that I have two different modules defined. A “Design Time” module and a “Run Time” module. The DesignTimeContext is a mock database. This allows me to avoid the need to access a real database for design time binding and I also use it for unit testing purposes.&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public class DesignTimeModule : NinjectModule {
    public override void Load() {
        Bind&amp;lt;IUnitOfWork&amp;gt;().To&amp;lt;DesignTimeContext&amp;gt;();
    }
}

public class RunTimeModule : NinjectModule {
    public override void Load()
    {
        Bind&amp;lt;IUnitOfWork&amp;gt;().To&amp;lt;MyContext&amp;gt;();
    }
}&lt;/pre&gt;

&lt;h2&gt;Step 2. Wire up the ViewModelLocator&lt;/h2&gt;

&lt;p&gt;The ViewModelLocator that comes with MVVM Light has a property called IsInDesignModeStatic which you can use to check if you are in design mode or not. We can use this property to figure out if we should utilize the DesignTimeModule or the RunTimeModule that we created in the previous step. &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public ViewModelLocator()
{
    if (ViewModelBase.IsInDesignModeStatic)
        _kernel = new StandardKernel(new DesignTimeModule());
    else
        _kernel = new StandardKernel(new RunTimeModule());

    About = _kernel.Get&amp;lt;AboutViewModel&amp;gt;();
    Main = _kernel.Get&amp;lt;MainViewModel&amp;gt;();
}&lt;/pre&gt;

&lt;p&gt;In my project, I have a ViewModel called ProjectListViewModel and the constructor takes an IUnitOfWork as it’s only parameter:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public ProjectListViewModel( IUnitOfWork unitOfWork )&lt;/pre&gt;

&lt;p&gt;In order to use this new ViewModel I need to add a property to my ViewModelLocator. As you can see below, I use the Ninject kernel to instantiate a new instance of the ProjectListViewModel. Ninject will also take care of creating a concrete IUnitOfWork implementation and inject it into the constructor based on the bindings we established earlier. &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public ProjectListViewModel ProjectList {
    get { return _kernel.Get&amp;lt;ProjectListViewModel&amp;gt;(); }
}&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Finally, in the ProjectList View I use the global instance of the ViewModelLocator to assign the ViewModel to the DataContext property. &lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&amp;lt;Window x:Class=&amp;quot;MyProject.View.ProjectList&amp;quot;
        xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
        xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot; 
        Title=&amp;quot;Projects&amp;quot; 
        Height=&amp;quot;450&amp;quot; 
        Width=&amp;quot;650&amp;quot;
        DataContext=&amp;quot;{Binding ProjectList, Source={StaticResource Locator}}&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;I must admit that having a mock database for design time is great because you can pre-populate your repositories with different kinds of data and get immediate feedback on how it works with your UI design. It also gives you the ability to see your databindings at work from within Visual Studio or Blend.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5iXIWKOEtzicCzgd-wh574mcVu4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5iXIWKOEtzicCzgd-wh574mcVu4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5iXIWKOEtzicCzgd-wh574mcVu4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5iXIWKOEtzicCzgd-wh574mcVu4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=kItLy-haLvE:_Hv5Lo4nQik:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=kItLy-haLvE:_Hv5Lo4nQik:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=kItLy-haLvE:_Hv5Lo4nQik:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=kItLy-haLvE:_Hv5Lo4nQik:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=kItLy-haLvE:_Hv5Lo4nQik:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=kItLy-haLvE:_Hv5Lo4nQik:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=kItLy-haLvE:_Hv5Lo4nQik:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/kItLy-haLvE" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/kItLy-haLvE/post.aspx</link>
      <comments>http://www.codecapers.com/post/Using-Ninject-with-MVVM-Light.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=6880ddb6-321c-4b8a-bbd4-f86e6a09e86f</guid>
      <pubDate>Sun, 06 Nov 2011 03:06:18 -0200</pubDate>
      <category>WPF</category>
      <category>MVVM</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=6880ddb6-321c-4b8a-bbd4-f86e6a09e86f</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=6880ddb6-321c-4b8a-bbd4-f86e6a09e86f</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/Using-Ninject-with-MVVM-Light.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=6880ddb6-321c-4b8a-bbd4-f86e6a09e86f</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=6880ddb6-321c-4b8a-bbd4-f86e6a09e86f</feedburner:origLink></item>
    <item>
      <title>Adding Export Capabilities to the Razor WebGrid</title>
      <description>&lt;p&gt;When MVC first came out I really missed having a native grid control. Now a few years later, we have grid support again! In case, you didn&amp;rsquo;t know the Razor WebGrid was included in the System.Web.Helpers assembly which shipped with ASP.NET MVC 3. Over the years, I have sampled a variety of grid controls such as jqGrid, the Infragistics grid control and the MvcContrib grid. Each grid control has its benefits and disadvantages but I think the new WebGrid offers a clean API which makes development tasks simple. Here is a screenshot of what the grid looks like:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=image_21.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" src="http://www.codecapers.com/image.axd?picture=image_thumb_21.png" border="0" alt="Default webGrid" width="513" height="257" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To display a grid on a razor view page, you basically create a new grid object, assign some properties and then call the GetHtml helper method. Here is an example:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;@{
    var grid = new WebGrid(canPage: true, canSort: true, rowsPerPage: Model.PagingInfo.PageSize, ajaxUpdateContainerId: "grid");
    grid.Bind(Model.Data, rowCount: Model.PagingInfo.TotalItems, autoSortAndPage: false);       
}

@grid.GetHtml(
    columns: new List&amp;lt;WebGridColumn&amp;gt;() {            
        grid.Column(columnName: "Id", header: "#" ),
        grid.Column(columnName: "Date", header: "Date"),
        grid.Column(columnName: "UniqueId", header: "Unique Id" ),
        grid.Column(columnName: "Text", header: "Random Text" )
    }) &lt;/pre&gt;
&lt;p&gt;Of course, displaying a simple table on a web page is never enough for my demanding clients. I needed to add some additional functionality to my grid, In particular I needed to add some exporting options to my grid. To get started I built out an export to CSV feature. By Utilizing the adapter pattern (a fancy way of saying I wrapped the method call) I was easily able to add in my custom html above the grid which has an export link. Here is my GetHtmlEx method:&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public static IHtmlString GetHtmlEx( 
    this WebGrid grid, &lt;/pre&gt;
&lt;pre class="brush: csharp;"&gt;    &amp;lt; a long list of parameters &amp;gt;
    string recordsText = RecordsText, 
    string pageText = PageText,
    string exportText = ExportText)
{
    var sb = new StringBuilder();
    sb.Append(grid.GetExportHtml());
    sb.Append(grid.GetHtml(tableStyle, headerStyle, footerStyle, rowStyle, alternatingRowStyle, selectedRowStyle,
                        caption, displayHeader, fillEmptyRows, emptyRowCellValue, columns, exclusions, mode, 
                        firstText, previousText, nextText, lastText, numericLinksCount, htmlAttributes));
    sb.Append(grid.GetTotalsHtml());
    return MvcHtmlString.Create(sb.ToString());
}        &lt;/pre&gt;
&lt;p&gt;Nothing too complicated here, just concatenating some HTML together and returning it as one big MvcHtmlString. The GetExportHtml method prints out the links for exporting to CSV. Since my method wraps the native GetHtml method, I just need to modify the view page and add an &amp;lsquo;Ex&amp;rsquo; to the end of the @grid.GetHtml method.&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;@grid.GetHtmlEx(..) &lt;/pre&gt;
&lt;p&gt;With the help of my wrapper above, my grid now has some new schizzle:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=image_22.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" title="image" src="http://www.codecapers.com/image.axd?picture=image_thumb_22.png" border="0" alt="image" width="523" height="295" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The code that actually exports the data to a CSV file is tucked away in my view model. However, In order to make my design modular and reusable, I created a base class called WebGridViewModel:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public abstract class WebGridViewModel&amp;lt;T&amp;gt;
{
    private IQueryable&amp;lt;T&amp;gt; _superset;        

    protected WebGridViewModel(WebGridSettings settings)
    {
        Settings = settings;                        
    }            
    
    public WebGridSettings Settings { get; set; }        

    public IPagination PagingInfo { 
        get { return Data as IPagination; } 
    }        

    protected abstract IQueryable&amp;lt;T&amp;gt; GetSuperSet();

    protected virtual IEnumerable&amp;lt;object&amp;gt; GetExportData()
    {
        return GetSuperSet() as IEnumerable&amp;lt;object&amp;gt;;
    }

    public ActionResult View( Controller controller, string viewName = "" )
    {
        var shouldExport = !String.IsNullOrWhiteSpace(Settings.ExportTo);            
        if( shouldExport ) return GetExportViewResult();

        controller.ViewData.Model = this;
        var viewResult = new ViewResult() {ViewData = controller.ViewData };

        if (!String.IsNullOrWhiteSpace(viewName))
            viewResult.ViewName = viewName;

        return viewResult;
    }

    private ActionResult GetExportViewResult()
    {
        var name = typeof(T).Name;
        return new CsvActionResult(name + ".csv", GetExportData().ToList());        
    }

    public IEnumerable&amp;lt;T&amp;gt; Data
    {
        get
        {
            if (_superset == null)
                _superset = GetSuperSet();
            
            var sortColumn = String.IsNullOrWhiteSpace(Settings.Sort) ? Settings.DefaultSort : Settings.Sort;
            var sort = String.Format("{0}{1}", sortColumn, String.IsNullOrWhiteSpace(Settings.SortDir) ? "" : " " + Settings.SortDir);
            var ordered = _superset.OrderBy(sort);                
            return ordered.AsPagination(Settings.Page ?? 1, Settings.PageSize);
        }
    }
}&lt;/pre&gt;
&lt;p&gt;So In order to build the model for my view, the only thing I have to do is inherit from WebGridViewModel and override the GetSuperSet method. I can optionally return a custom result set for the export by overriding the GetExportData method:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public class MyGridViewModel : WebGridViewModel&amp;lt;FakeData&amp;gt;
{
    public MyGridViewModel( WebGridSettings gridSettings )
        : base( gridSettings )
    {
        gridSettings.DefaultSort = "Id";            
    }

    protected override IQueryable&amp;lt;FakeData&amp;gt; GetSuperSet()
    {
        return FakeData.Records;
    }
}&lt;/pre&gt;
&lt;p&gt;In real life, the GetSuperSet method would hit a database and return some records. However, in order to keep things simple I am using some static data. The Index action of my Home controller takes care of creating the view model and passes it along to the View. Before I added the export feature, my controller action looked like this:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public ActionResult Index( WebGridSettings gridSettings )
{
    var model = new MyGridViewModel(gridSettings);
    return View(model);
}&lt;/pre&gt;
&lt;p&gt;However, now that my grid supports exporting, I need to support two different action results. A standard ViewResult for displaying the grid on the view page and a custom ActionResult which takes care of building the CSV file and returning it to the client via the response stream. If you look at the implementation details of the WebGridViewModel you may have noticed a method called &amp;ldquo;View&amp;rdquo; which basically detects whether or not an export was requested and conditionally returns a regular ViewResult or a CsvActionResult. So the only thing I need to change in the Index method is the return statement:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public ActionResult Index( WebGridSettings gridSettings )
{
    var model = new MyGridViewModel(gridSettings);
    return model.View(this);
}&lt;/pre&gt;
&lt;p&gt;So now when the &lt;em&gt;Home/Index&lt;/em&gt; action is called a standard view is returned. However, when you click on the export hyperlink link an additional query string parameters is added to the url named &lt;strong&gt;ExportTo &lt;/strong&gt;with a value of &lt;strong&gt;CSV &lt;/strong&gt;(&lt;em&gt;Home/Index?ExportTo=CSV&lt;/em&gt;)&lt;strong&gt;. &lt;/strong&gt;The WebGridViewModel inspects the ExportTo parameter and will automatically determine if a CSV file should be returned.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codecapers.com/file.axd?file=2011%2f9%2fCodeCapers.WebGrid.zip"&gt;Download The Sample Code (468.61 kb)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mypgvrgK7rjSDWQkxjwu1YmFudY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mypgvrgK7rjSDWQkxjwu1YmFudY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mypgvrgK7rjSDWQkxjwu1YmFudY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mypgvrgK7rjSDWQkxjwu1YmFudY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=PM46GL1YbZE:VrP-_Tos4TU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=PM46GL1YbZE:VrP-_Tos4TU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=PM46GL1YbZE:VrP-_Tos4TU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=PM46GL1YbZE:VrP-_Tos4TU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=PM46GL1YbZE:VrP-_Tos4TU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=PM46GL1YbZE:VrP-_Tos4TU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=PM46GL1YbZE:VrP-_Tos4TU:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/PM46GL1YbZE" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/PM46GL1YbZE/post.aspx</link>
      <comments>http://www.codecapers.com/post/Adding-Export-Capabilities-to-the-Razor-WebGrid.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=2cee8282-8765-4850-ba13-ab9e43a90911</guid>
      <pubDate>Sat, 03 Sep 2011 03:22:00 -0200</pubDate>
      <category>ASPNet</category>
      <category>MVC</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=2cee8282-8765-4850-ba13-ab9e43a90911</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=2cee8282-8765-4850-ba13-ab9e43a90911</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/Adding-Export-Capabilities-to-the-Razor-WebGrid.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=2cee8282-8765-4850-ba13-ab9e43a90911</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=2cee8282-8765-4850-ba13-ab9e43a90911</feedburner:origLink></item>
    <item>
      <title>Building MVC Select Lists The Easy Way</title>
      <description>&lt;p&gt;It is common to have a view model that contains a list of select list items ( IEnumerable&lt;SelectListItem&gt; ). However, I get a little annoyed when I see a select list item getting initialized like this:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;Widgets = db.Widgets.FindAll().Select(x =&amp;gt; new SelectListItem() { Text = x.Name, Value = x.Value });&lt;/pre&gt;

&lt;p&gt;Although this is legal syntax its just a little bit too ugly for my liking. In an effort to make life simpler I came up with the following helper class:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public static class SelectListFactory
{
    public static IEnumerable&amp;lt;SelectListItem&amp;gt; BuildList&amp;lt;T&amp;gt;(IEnumerable&amp;lt;T&amp;gt; items, Func&amp;lt;T, SelectListItem&amp;gt; func)
    {
        return items.Select(func);
    }        

    public static IEnumerable&amp;lt;SelectListItem&amp;gt; BuildList&amp;lt;T&amp;gt;(
        IEnumerable&amp;lt;T&amp;gt; items,
        Func&amp;lt;T, string&amp;gt; text,
        Func&amp;lt;T, string&amp;gt; value = null,
        Func&amp;lt;T, Boolean&amp;gt; selected = null)
    {
        return items.Select(x =&amp;gt; new SelectListItem{
            Text = text.Invoke(x),
            Value = value == null ? text.Invoke(x) : value.Invoke(x),
            Selected = selected == null ? false : selected.Invoke(x)
        });            
    }        
}    &lt;/pre&gt;

&lt;p&gt;With the help of our new SelectListFactory we can now re-write that first block of code as:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;Widgets = SelectListFactory.BuildList( db.Widgets.FindAll(), x =&amp;gt; x.Name, x =&amp;gt; x.Value );&lt;/pre&gt;

&lt;p&gt;Hmm, not to shabby. However, I think an extension method could make it even cleaner... &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public static class SelectListExtensions
{
    public static IEnumerable&amp;lt;SelectListItem&amp;gt; BuildList&amp;lt;T&amp;gt;(
            this IEnumerable&amp;lt;T&amp;gt; items,
            Func&amp;lt;T, string&amp;gt; text,
            Func&amp;lt;T, string&amp;gt; value = null,
            Func&amp;lt;T, Boolean&amp;gt; selected = null
        )
    {
        return SelectListFactory.BuildList(items, text, value, selected);
    }
}&lt;/pre&gt;

&lt;p&gt;So now lets rewrite the method using our new extension method...&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;Widgets =  db.Widgets.BuildList( x =&amp;gt; x.Name, x =&amp;gt; x.Value );&lt;/pre&gt;

&lt;p&gt;Now that is considerably better than what we started with! Happy Coding!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HCqQ6vq-ZGELsVgmIKfTnmcekIk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HCqQ6vq-ZGELsVgmIKfTnmcekIk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HCqQ6vq-ZGELsVgmIKfTnmcekIk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HCqQ6vq-ZGELsVgmIKfTnmcekIk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=jvtbVctSR_0:Glfn73l3OzQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=jvtbVctSR_0:Glfn73l3OzQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=jvtbVctSR_0:Glfn73l3OzQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=jvtbVctSR_0:Glfn73l3OzQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=jvtbVctSR_0:Glfn73l3OzQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=jvtbVctSR_0:Glfn73l3OzQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=jvtbVctSR_0:Glfn73l3OzQ:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/jvtbVctSR_0" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/jvtbVctSR_0/post.aspx</link>
      <comments>http://www.codecapers.com/post/Building-MVC-Select-Lists-The-Easy-Way.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=21b9e465-e71e-41d4-ba7d-4f2a9d9b2ab4</guid>
      <pubDate>Mon, 18 Jul 2011 00:01:00 -0200</pubDate>
      <category>ASPNet</category>
      <category>MVC</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=21b9e465-e71e-41d4-ba7d-4f2a9d9b2ab4</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=21b9e465-e71e-41d4-ba7d-4f2a9d9b2ab4</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/Building-MVC-Select-Lists-The-Easy-Way.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=21b9e465-e71e-41d4-ba7d-4f2a9d9b2ab4</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=21b9e465-e71e-41d4-ba7d-4f2a9d9b2ab4</feedburner:origLink></item>
    <item>
      <title>MVC–Showing a setup screen on the first run</title>
      <description>&lt;p&gt;Recently, I participated in a project where I helped to build a &lt;a href="http://www.ene.com" target="_blank"&gt;website&lt;/a&gt; in &lt;a href="http://orchard.codeplex.com/" target="_blank"&gt;Orchard&lt;/a&gt;. One of the things that I admire (and there are many) about Orchard is the setup screen that appears the first time you run the site. It&amp;rsquo;s a nice touch and really makes the site easy to configure. No need to tweak a web.config, create a database or read a 20 page setup guide on how to get started. You just fill out the form and the site is ready&amp;hellip;&lt;/p&gt;
&lt;p&gt;Of course, I wanted to build something similar for my open source project &lt;a href="http://weblog.codeplex.com/" target="_blank"&gt;WeBlog&lt;/a&gt;. First, I tried to reverse engineer the orchard code. However, orchard uses a lot of dynamic types and things are heavily abstracted so it was hard to re-use their code for my purposes. Next, I tried to Google for a solution but the only thing I could find was this &lt;a href="http://stackoverflow.com/questions/6007277/create-a-one-time-setup-screen-the-first-time-the-application-loads-based-on-crit" target="_blank"&gt;stack overflow post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;My first thought was to create a base controller class and override the OnActionExecuting method. In that method I could force a redirect if the site was not configured yet. However, I abandoned this strategy because at this point in the process the wrong controller has already been created (the one assigned to the default route) and I basically have to cancel the previous request and redirect. Therefore,&amp;nbsp;I decided to use a custom controller factory instead. This way I can intercept which controller and action should be fired if the site has not been configured yet much earlier in the process. Here is what I came up with:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;public class WeBlogControllerFactory : DefaultControllerFactory
{
    public override IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
    {
        if (!SiteManager.Any())
        {
            requestContext.RouteData.Values["action"] = "Index";
            requestContext.RouteData.Values["controller"] = "Setup";
            return base.CreateController(requestContext, "Setup");
        }

        return base.CreateController(requestContext, controllerName);
    }
}&lt;/pre&gt;
&lt;p&gt;Finally, you will need to register your custom controller factory, just add this line to the application_start method in the global.asax:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;ControllerBuilder.Current.SetControllerFactory(new WeBlogControllerFactory());&lt;/pre&gt;
&lt;p&gt;So now when my application runs the first time I get the setup screen. Sweet!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=weblog_setup_screen.jpg"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="weblog_setup_screen" src="http://www.codecapers.com/image.axd?picture=weblog_setup_screen_thumb.jpg" border="0" alt="weblog_setup_screen" width="333" height="336" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://weblog.codeplex.com/SourceControl/changeset/changes/aa84cce4a80b" target="_blank"&gt;code&lt;/a&gt; can be viewed here. Please leave a comment if you have an alternative solution.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Yp3ldbASzuKNvsUMD05V0_lzvSQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Yp3ldbASzuKNvsUMD05V0_lzvSQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Yp3ldbASzuKNvsUMD05V0_lzvSQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Yp3ldbASzuKNvsUMD05V0_lzvSQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=qbQV7oH8Kko:c8GePIh-vBY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=qbQV7oH8Kko:c8GePIh-vBY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=qbQV7oH8Kko:c8GePIh-vBY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=qbQV7oH8Kko:c8GePIh-vBY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=qbQV7oH8Kko:c8GePIh-vBY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=qbQV7oH8Kko:c8GePIh-vBY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=qbQV7oH8Kko:c8GePIh-vBY:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/qbQV7oH8Kko" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/qbQV7oH8Kko/post.aspx</link>
      <comments>http://www.codecapers.com/post/MVC–Showing-a-setup-screen-on-the-first-run.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=ed8ddaca-607c-4dc9-ac82-8eb1b6b2a182</guid>
      <pubDate>Sat, 09 Jul 2011 02:16:00 -0200</pubDate>
      <category>ASPNet</category>
      <category>MVC</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=ed8ddaca-607c-4dc9-ac82-8eb1b6b2a182</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=ed8ddaca-607c-4dc9-ac82-8eb1b6b2a182</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/MVC–Showing-a-setup-screen-on-the-first-run.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=ed8ddaca-607c-4dc9-ac82-8eb1b6b2a182</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=ed8ddaca-607c-4dc9-ac82-8eb1b6b2a182</feedburner:origLink></item>
    <item>
      <title>Dapper.Net - A Micro ORM that puts you back in control</title>
      <description>&lt;p&gt;Its fun to reminisce about how database access has evolved over the years. In the early days I used to write parameterized SQL statements directly in my code. Eventually that evolved into using stored procedures. Mainly because by using a stored procedure I could change the way data was gathered without recompiling my source code. Eventually, I abandoned stored procedures altogether when LINQ to SQL was released. Finally, if we fast forward to the current day, my preferred method of accessing data is with EF code first. EF Code first is great because I can spend even less time managing my database and more time solving business problems. With the level of abstraction getting higher and higher it makes you wonder if perhaps the next generation of developers will not even write T-SQL anymore. They will probably laugh at us old timers when we talk about stored procs and T-SQL.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=human-evolution_1.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="human-evolution" src="http://www.codecapers.com/image.axd?picture=human-evolution_thumb_1.jpg" border="0" alt="human-evolution" width="543" height="255" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Wait! Back up a minute! Just because we have abstracted ourselves from the database doesn&amp;rsquo;t mean that we have evolved into something superior. In my past life as a DBA, I spent many of long afternoons diagnosing performance issues. Most of the issues were due to auto-generated SQL statements from an ORM. Sometimes you could put a band-aid on the problem by adding a few indexes or modifying the source code to force different SQL to be produced. However, I was always frustrated by the fact that I had to trade abstraction for performance. Wouldn&amp;rsquo;t it be nice to have both&amp;hellip;.&lt;/p&gt;
&lt;p&gt;Well you can. Sam Saffron, one of the geniuses at Stack Overflow, came up with a micro ORM called &lt;a href="http://code.google.com/p/dapper-dot-net/" target="_blank"&gt;dapper dot net&lt;/a&gt;. Dapper dot net is a single file that you can drop into your project that will extend your IDbConnection interface. As I have said so many times before, let&amp;rsquo;s have the code do the talking.&lt;/p&gt;
&lt;h2&gt;Executing a query and mapping the results to a strongly typed list&lt;/h2&gt;
&lt;pre class="brush: csharp;"&gt;public class Dog
{
    public int? Age { get; set; }
    public Guid Id { get; set; }
    public string Name { get; set; }
    public float? Weight { get; set; }

    public int IgnoredProperty { get { return 1; } }
}            
            
var guid = Guid.NewGuid();
var dog = connection.Query&amp;lt;Dog&amp;gt;("select Age = @Age, Id = @Id", new { Age = (int?)null, Id = guid });
            
dog.Count()
    .IsEqualTo(1);

dog.First().Age
    .IsNull();

dog.First().Id
    .IsEqualTo(guid);&lt;/pre&gt;
&lt;p&gt;Notice that strange stuff in the middle. Yeah, that&amp;rsquo;s called a SQL Statement. Anyways, my point is that we get full control over our SQL statement and in addition we also get a strongly typed result set. Pretty sweet huh?&lt;/p&gt;
&lt;h2&gt;Multi-Mapping&lt;/h2&gt;
&lt;pre class="brush: csharp;"&gt;var sql = 
@"select * from #Posts p 
left join #Users u on u.Id = p.OwnerId 
Order by p.Id";
 
var data = connection.Query&amp;lt;Post, User&amp;gt;(sql, (post, user) =&amp;gt; { post.Owner = user; });
var post = data.First();
 
post.Content.IsEqualTo("Sams Post1");
post.Id.IsEqualTo(1);
post.Owner.Name.IsEqualTo("Sam");
post.Owner.Id.IsEqualTo(99);&lt;/pre&gt;
&lt;p&gt;This is an example of mapping a single row to multiple objects. In EF or Linq to SQL you would accomodate this functionality by leveraging a foreign key relationship. Once again, we have full control of the SQL and strongly typed results.&lt;/p&gt;
&lt;h2&gt;Multiple Results&lt;/h2&gt;
&lt;pre class="brush: csharp;"&gt;var sql = 
@"
select * from Customers where CustomerId = @id
select * from Orders where CustomerId = @id
select * from Returns where CustomerId = @id";
 
using (var multi = connection.QueryMultiple(sql, new {id=selectedId}))
{
   var customer = multi.Read&amp;lt;Customer&amp;gt;().Single();
   var orders = multi.Read&amp;lt;Order&amp;gt;().ToList();
   var returns = multi.Read&amp;lt;Return&amp;gt;().ToList();
   ...
} &lt;/pre&gt;
&lt;p&gt;Multiple resultsets, a single trip to the server and full control of the SQL. Need I say more?&lt;/p&gt;
&lt;h2&gt;So Should You Abandon Your Current ORM?&lt;/h2&gt;
&lt;p&gt;In my opinion, a developer should never settle on a single tool. Being abstracted from the nitty gritty details of writing SQL allows a developer to be more productive. In addition, if you are building small to medium size applications you can afford a small performance penalty because you are probably not dealing with tons of data. Unfortunately, you can't always predict the future of your application. You may start out with 10 users and end up with 10 thousand users. So perhaps the strategy is to develop most of your application using an ORM like EF Magic unicorn and then use Dapper for the parts of your application that need to be performant. This way you get the best of both worlds!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ruDFVkwLE-4L_rWmid4mxUJmNNM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ruDFVkwLE-4L_rWmid4mxUJmNNM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ruDFVkwLE-4L_rWmid4mxUJmNNM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ruDFVkwLE-4L_rWmid4mxUJmNNM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4qDfvVFhTPc:9orqm3mshxE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4qDfvVFhTPc:9orqm3mshxE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4qDfvVFhTPc:9orqm3mshxE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=4qDfvVFhTPc:9orqm3mshxE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4qDfvVFhTPc:9orqm3mshxE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=4qDfvVFhTPc:9orqm3mshxE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4qDfvVFhTPc:9orqm3mshxE:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/4qDfvVFhTPc" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/4qDfvVFhTPc/post.aspx</link>
      <comments>http://www.codecapers.com/post/DapperNet-A-Micro-ORM-that-puts-you-back-in-control.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=109c3626-f6d2-4b11-b062-8a4db64d1199</guid>
      <pubDate>Thu, 12 May 2011 23:48:00 -0200</pubDate>
      <category>dotNet</category>
      <category>SQL</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=109c3626-f6d2-4b11-b062-8a4db64d1199</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=109c3626-f6d2-4b11-b062-8a4db64d1199</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/DapperNet-A-Micro-ORM-that-puts-you-back-in-control.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=109c3626-f6d2-4b11-b062-8a4db64d1199</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=109c3626-f6d2-4b11-b062-8a4db64d1199</feedburner:origLink></item>
    <item>
      <title>Building a Nuget Server with gold plating</title>
      <description>&lt;p&gt;Last week, Phil Haack wrote a post on &lt;a href="http://haacked.com/archive/2011/03/31/hosting-simple-nuget-package-feed.aspx" target="_blank"&gt;how to build a NuGet Server&lt;/a&gt;. A NuGet server is really easy to build because 90% of the work is done by running a NuGet command. Just for fun, I decided to add some extra functionality to my NuGet Server such as a package upload form and a formatted list of packages.&amp;#160; &lt;/p&gt;  &lt;p&gt;In preparing my NuGet server, I followed Phil’s direction to a tee except for the fact that I used a “empty MVC 3 app with Razor support” instead of using a “ASP.NET Empty Web Application”. Out of the box, you will get a barebones, but fully functional NuGet server that provides the package list in Atom Format. For each package in the repository you will get access to properties such as the version number, license information, tags and etcetera. However, since I am not a fan of reading XML I thought it would be useful to transform that XML into HTML using &lt;a href="http://en.wikipedia.org/wiki/XSLT" target="_blank"&gt;XSLT&lt;/a&gt;. This way I can see the list of available packages without opening up Visual Studio. XSLT is one of those technologies that I have always read about but never used. So in the spirit of learning I decided to give it a try. &lt;/p&gt;  &lt;p&gt;XSLT stands for Extensible Stylesheet Language Transformation. The basic concept is to take a XML file and apply a series of transformations to the underlying data which produces a human-readable HTML file. In order to get this working, I leveraged &lt;a href="http://tpeczek.blogspot.com/2009/12/xml-and-xslt-transformation-in-aspnet_21.html" target="_blank"&gt;Tomas Peczek’s XmlActionResult class&lt;/a&gt;. Since Tomas did all the hard work, it’s just a matter of loading an XML doc, assigning it to an XmlActionResult and specifying the Transform Source:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;[ChildActionOnly]
public ActionResult PackageList()
{
    var doc = new XmlDocument();
    string path = GetUrl(&amp;quot;/nuget/Packages&amp;quot;).ToString();
    doc.Load(path);
    var result = new XmlActionResult();
    result.Document = doc;
    result.TransformSource = Server.MapPath(&amp;quot;~/Content/xsl/packages.xsl&amp;quot;);
    return result;
}&lt;/pre&gt;

&lt;p&gt;From the code snippet above, you can see that I created a XML transformation file named packages.xsl. I then applied the XSL file to the “Atom” package feed. Unfortunately, learning XSLT is a subject too large for me to try to cover in a single blog post. However, the basic concepts are simple and I was able to come up with a working prototype in about 10 minutes. If you are new to XSL, I would recommend reading he &lt;a href="http://www.w3schools.com/xsl/" target="_blank"&gt;tutorials at W3Schools&lt;/a&gt;. Also notice, that I added the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.childactiononlyattribute.aspx" target="_blank"&gt;ChildActionOnly&lt;/a&gt; attribute to my controller method. This means that this content can only be called by using the Action or RenderAction HTML Helper method. Since I am using a master page in my solution, I only render the inline HTML markup for part of the view instead of a complete HTML document. Here is the markup for the view which displays the package list. As you can see, it’s just a dead simple Razor page that uses the Html.Action helper method to inject the HTML returned by the PackageList method into the view.&amp;#160; &lt;/p&gt;

&lt;pre class="brush: xml;"&gt;@{
    ViewBag.Title = &amp;quot;Index&amp;quot;;
}

&amp;lt;h4&amp;gt;Packages&amp;lt;/h4&amp;gt;

@Html.Action(&amp;quot;PackageList&amp;quot;)&lt;/pre&gt;

&lt;p&gt;Here is a screenshot of the Package list page. You may notice that one of the packages below is an Orchard widget that I created. I will be blogging more about Orchard development in the near future so stay tuned…&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=nuget-packagelist.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="nuget-packagelist" border="0" alt="nuget-packagelist" src="http://www.codecapers.com/image.axd?picture=nuget-packagelist_thumb.png" width="437" height="295" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Besides a formatted package list I also added an upload form. This was a simple task of taking the uploaded file and saving it to the packages directory of the web site. Here is a screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=nuget-index.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="nuget-index" border="0" alt="nuget-index" src="http://www.codecapers.com/image.axd?picture=nuget-index_thumb.png" width="442" height="245" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are interested in using this code for your own purposes you can &lt;a href="https://bitbucket.org/mceranski/nugetserver" target="_blank"&gt;download the full source code here&lt;/a&gt; via BitBucket. If you want to add any cool features to the server then I will be happy to grant access to the repository. Enjoy!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xOcNYANUlMqX3-4BgN4rIZ7O5rg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xOcNYANUlMqX3-4BgN4rIZ7O5rg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xOcNYANUlMqX3-4BgN4rIZ7O5rg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xOcNYANUlMqX3-4BgN4rIZ7O5rg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rAexOusCDQY:UX0g7ELJWOA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rAexOusCDQY:UX0g7ELJWOA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rAexOusCDQY:UX0g7ELJWOA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=rAexOusCDQY:UX0g7ELJWOA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rAexOusCDQY:UX0g7ELJWOA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=rAexOusCDQY:UX0g7ELJWOA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rAexOusCDQY:UX0g7ELJWOA:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/rAexOusCDQY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/rAexOusCDQY/post.aspx</link>
      <comments>http://www.codecapers.com/post/Building-a-Nuget-Server-with-gold-plating.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=4dc90dba-60f6-49b7-bcb9-269dae6a49de</guid>
      <pubDate>Tue, 05 Apr 2011 00:32:08 -0200</pubDate>
      <category>ASPNet</category>
      <category>Programming</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=4dc90dba-60f6-49b7-bcb9-269dae6a49de</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=4dc90dba-60f6-49b7-bcb9-269dae6a49de</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/Building-a-Nuget-Server-with-gold-plating.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=4dc90dba-60f6-49b7-bcb9-269dae6a49de</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=4dc90dba-60f6-49b7-bcb9-269dae6a49de</feedburner:origLink></item>
    <item>
      <title>MVC Tip - An easy way to deal with those NotFound Errors</title>
      <description>&lt;p&gt;My first introduction to MVC was the Nerd Dinner tutorial. From that tutorial I adopted the concept of redirecting the user to a “NotFound” page when a item was requested that does not exist. Here is an example of a controller action that returns the “NotFound” view:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public ActionResult Activate(int id)
{
    User user = _repository.FindById(id);
    if (user == null) return View(&amp;quot;NotFound&amp;quot;);
    //other code....
    return View(&amp;quot;Activated&amp;quot;);            
}&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;However, a problem may come into play when you try to encapsulate logic in a model class. For example, let's suppose I have a class named EditUserViewModel which loads the details for a user account. The constructor takes a repository and an integer value which represents the primary key used in the database.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class EditUserFormViewModel
{
    public EditUserFormViewModel( IUserRepository repository, int id  ) : base()
    {            
        var user = repository.FindById(id);                
        //Load properties...
    }    
}&lt;/pre&gt;

&lt;p&gt;This is cool because the logic is now hidden inside the model class which has the desirable side effect of keeping the controller lightweight:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public ActionResult Edit(int id)
{
    var model = new EditUserFormViewModel(_repository, id);            
    return View(model);
}&lt;/pre&gt;

&lt;p&gt;The only issue now is that the code that retrieves the user from the repository is inside the model class. This means that I can no longer can easily check if the user is null and return the request to the NotFound page. So as a result, I came up with this simple solution. The first step is to create a new custom exception class called NotFoundException:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class NotFoundException : Exception
{
    public NotFoundException() {}

    public NotFoundException( string message ) 
        : base( message )
    {            
    }

    public NotFoundException(string message, Exception innerException)
        : base(message, innerException)
    {
    }
}&lt;/pre&gt;

&lt;p&gt;Next, inside the EditUserViewModel, when a repository call returns a null object, I throw a NotFoundException: &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public EditUserFormViewModel( IUserRepository repository, int id  ) : base()
{            
    var user = repository.FindById(id);
    if( user == null ) throw new NotFoundException();
    ...
}&lt;/pre&gt;

&lt;p&gt;Finally, since I am always use a base controller class, I can easily add a little bit of &amp;quot;centralized&amp;quot; code to streamline the process of handling all those potential NotFoundExceptions. I start by creating a new method named NotFound(). The NotFound() method has two purposes:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It creates a strongly typed reference to the NotFound view which can be used in any of my controllers. So if I decide to return the NotFound view anywhere in my application I can call NotFound() instead of View(&amp;quot;NotFound&amp;quot;). &lt;/li&gt;

  &lt;li&gt;I override the OnException in the base controller class so whenever a NotFoundException is thrown I automatically redirect the user my NotFound view by calling the NotFound() method. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the code:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class ApplicationController : Controller
{
    public ActionResult NotFound()
    {
        return View(&amp;quot;NotFound&amp;quot;);
    }

    protected override void OnException(ExceptionContext filterContext)
    {
        if (filterContext.Exception is NotFoundException)
        {
            filterContext.Result = NotFound();
            filterContext.ExceptionHandled = true;
            return;
        }

        base.OnException(filterContext);
    }

    ...
}&lt;/pre&gt;

&lt;p&gt;Anyway, I thought this was a great approach to handling NotFound errors. Hopefully you will find it useful too.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9-TwGhExlUIKjyE6ySHNTkoQ4Dc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9-TwGhExlUIKjyE6ySHNTkoQ4Dc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9-TwGhExlUIKjyE6ySHNTkoQ4Dc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9-TwGhExlUIKjyE6ySHNTkoQ4Dc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4sMl2alPsMs:W4sTkvaqBCw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4sMl2alPsMs:W4sTkvaqBCw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4sMl2alPsMs:W4sTkvaqBCw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=4sMl2alPsMs:W4sTkvaqBCw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4sMl2alPsMs:W4sTkvaqBCw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=4sMl2alPsMs:W4sTkvaqBCw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=4sMl2alPsMs:W4sTkvaqBCw:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/4sMl2alPsMs" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/4sMl2alPsMs/post.aspx</link>
      <comments>http://www.codecapers.com/post/MVC-Tip-An-easy-way-to-deal-with-those-NotFound-Errors.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=02462ab5-4d3c-4837-bf88-a9210cc56016</guid>
      <pubDate>Fri, 04 Feb 2011 00:11:54 -0200</pubDate>
      <category>ASPNet</category>
      <category>MVC</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=02462ab5-4d3c-4837-bf88-a9210cc56016</pingback:target>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=02462ab5-4d3c-4837-bf88-a9210cc56016</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/MVC-Tip-An-easy-way-to-deal-with-those-NotFound-Errors.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=02462ab5-4d3c-4837-bf88-a9210cc56016</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=02462ab5-4d3c-4837-bf88-a9210cc56016</feedburner:origLink></item>
    <item>
      <title>ASP.NET MVC Unit Testing with UpdateModel and TryUpdateModel</title>
      <description>&lt;p&gt;&lt;a href="http://www.codecapers.com/image.axd?picture=06_Red_Green_Refactor.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 0px 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="06_Red_Green_Refactor" border="0" alt="06_Red_Green_Refactor" align="right" src="http://www.codecapers.com/image.axd?picture=06_Red_Green_Refactor_thumb.jpg" width="244" height="146" /&gt;&lt;/a&gt;Last week I was in the middle of re-writing an old MVC application. The app was written during the early days of MVC, and as a consequence it was a playground for learning and experimentation. As a developer, I am continuously learning new tricks so its’ no surprise that when I look at the code I wrote a few years ago I often refactor it. For example, when I started out with ASP.NET MVC I did not fully understand how the model binders worked. Unfortunately, this meant that some of my controller actions ended up looking like this:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;[HttpPost]
public ActionResult Edit( Guid id, FormCollection form )
{
    var foo = new SomeModel();
    foo.Id = id;
    foo.Name = form[&amp;quot;Name&amp;quot;];
    foo.Date = DateTime.Parse(form[&amp;quot;EffectiveDate&amp;quot;]);
    foo.Description = form[&amp;quot;Description&amp;quot;];
    ....

    if (ModelState.IsValid)
    {
        ...Save and redirect
    }

    return View(model);            
}&lt;/pre&gt;

&lt;p&gt;Yuck! Referencing form collections in your controller are a major no no! The problem with using a form collection is that it is not strongly typed and it is prone to errors. Its easy to make a typo or get your controller action out of sync with your view. Therefore it is preferred when you can bind directly to a view model or utilize the UpdateModel or TryUpdateModel methods to parse the form. For example the code above can be rewritten as:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;[HttpPost]
public ActionResult Edit( Guid id )
{&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;pre class="brush: csharp;"&gt;    var foo = new SomeModel();
    UpdateModel( foo );

    if (ModelState.IsValid)
    {
        ...Save and redirect
    }

    return View(model);            
}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can clearly see, the implementation is cleaner and requires much less maintenance by the developer. Anyways, as I continued on my quest to refactor old code, I made it a point to add some unit tests so I could ensure that my refactoring efforts did not break any existing functionality:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;[Test]
public void Edit_Post_Action_Updates_Model_And_Redirects()
{
    //Arrange
    var repository = new FakeRepository();
    var foo = new SomeModel() { Id = 1, Name = &amp;quot;Test&amp;quot;, Date = DateTime.Parse(&amp;quot;1/1/2010&amp;quot;), Description = &amp;quot;Bar&amp;quot; };     
    _repository.Add( foo);

    var model = new SomeViewModel(_repository, foo.Id);
    var controller = new MyController(_repository);
    
    //Act
    var result = controller.Edit(foo.Id, model) as RedirectToRouteResult;

    //Assert
    Assert.IsNotNull(result);            
    Assert.AreEqual( result.RouteValues[&amp;quot;action&amp;quot;], &amp;quot;Index&amp;quot; );

    var updated = repository.SingleOrDefault( x =&amp;gt; x.Id == 1 );
    Assert.IsNotNull(updated);
    Assert.AreEqual(updated.Name, &amp;quot;Test&amp;quot; );
    Assert.AreEqual(updated.Date, DateTime.Parse(&amp;quot;1/1/2010&amp;quot;) );
    Assert.AreEqual(updated.Description, &amp;quot;Bar&amp;quot; );
}&lt;/pre&gt;

&lt;p&gt;Unfortunately when I ran the unit test, the following error was thrown during the call to UpdateModel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;System.NullReferenceException : Object reference not set to an instance of an object.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Luckily, I have run into this problem before so I knew how to fix it. However, I know that not everyone has leveraged Unit Testing in MVC before. So I thought I would document the steps that are required to successfully test a method that utilizes TryUpdateModel or UpdateModel:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;You need to fake out the controller context. This can be easily done my adding a reference to &lt;a href="http://code.google.com/p/moq/" target="_blank"&gt;Moq&lt;/a&gt; and taking advantage of the &lt;a href="http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx" target="_blank"&gt;MvcMockHelpers&lt;/a&gt; created by Scott Hanselman. The helper class is used to fake out things like the HttpContext. The magic is all secretly contained in the SetFakeControllerContext extension method. &lt;/li&gt;

  &lt;li&gt;You need to fake out the form values. Why, because at runtime, the model binder associates form values with model properties via reflection. In other words, if you have a textbox with named “FirstName”, a call to UpdateModel will automatically associate it with the model’s property of the same name. This is the exactly the same as what we did in the first example, when we explicitly set the model.FirstName = form[“FirstName”]. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the updated unit test that runs successfully:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;[Test]
public void Edit_Post_Action_Updates_Model_And_Redirects()
{
    //Arrange
    var repository = new FakeRepository();
    var foo = new SomeModel() { Id = 1, Name = &amp;quot;Foo&amp;quot;, Date = DateTime.Parse(&amp;quot;1/1/1999&amp;quot;), Description = &amp;quot;Bar&amp;quot; };     
    _repository.Add( foo);

    var model = new SomeViewModel(_repository, foo.Id);
    var controller = new MyController(_repository);
    controller.SetFakeControllerContext();
    
    //Act
    var result = controller.Edit(foo.Id, model) as RedirectToRouteResult;
    controller.SetFakeControllerContext();

    var fakeForm = new FormCollection();
    fakeForm.Add(&amp;quot;Name&amp;quot;, &amp;quot;Hello&amp;quot;);
    fakeForm.Add(&amp;quot;Date&amp;quot;, &amp;quot;1/1/2010&amp;quot;);
    fakeForm.Add(&amp;quot;Description&amp;quot;, &amp;quot;World&amp;quot; );
    controller.ValueProvider = fakeForm.ToValueProvider();
    
    //Assert
    Assert.IsNotNull(result);            
    Assert.AreEqual( result.RouteValues[&amp;quot;action&amp;quot;], &amp;quot;Index&amp;quot; );

    var updated = repository.SingleOrDefault( x =&amp;gt; x.Id == 1 );
    Assert.IsNotNull(updated);
    Assert.AreEqual(updated.Name, &amp;quot;Hello&amp;quot; );
    Assert.AreEqual(updated.Date, DateTime.Parse(&amp;quot;1/1/2010&amp;quot;) );
    Assert.AreEqual(updated.Description, &amp;quot;World&amp;quot; );
}&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;In conclusion, try to avoid using form collections and take advantage of the model binding that MVC has provided us with. If you are not unit testing your controllers then you should start immediately. Although unit testing may cost you some extra work up front, you should see a return on investment due to a reduced bug rate. In addition, when you have good test coverage you will rest assured at night knowing that your code is stable and in proper working order.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lVLxytcIQcStVUlldHzoDB8s7XU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lVLxytcIQcStVUlldHzoDB8s7XU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lVLxytcIQcStVUlldHzoDB8s7XU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lVLxytcIQcStVUlldHzoDB8s7XU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rdGR-F7aQb0:D6S5pGP8kMw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rdGR-F7aQb0:D6S5pGP8kMw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rdGR-F7aQb0:D6S5pGP8kMw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=rdGR-F7aQb0:D6S5pGP8kMw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rdGR-F7aQb0:D6S5pGP8kMw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?i=rdGR-F7aQb0:D6S5pGP8kMw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/codecapers?a=rdGR-F7aQb0:D6S5pGP8kMw:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/codecapers?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/codecapers/~4/rdGR-F7aQb0" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/codecapers/~3/rdGR-F7aQb0/post.aspx</link>
      <comments>http://www.codecapers.com/post/ASPNET-MVC-Unit-Testing-UpdateModel-and-TryUpdateModel.aspx#comment</comments>
      <guid isPermaLink="false">http://www.codecapers.com/post.aspx?id=041a52e0-9820-4216-ab90-2aee3ee72269</guid>
      <pubDate>Tue, 25 Jan 2011 23:45:00 -0200</pubDate>
      <category>ASPNet</category>
      <category>MVC</category>
      <category>Tech</category>
      <dc:publisher>mikeceranski</dc:publisher>
      <pingback:server>http://www.codecapers.com/pingback.axd</pingback:server>
      <pingback:target>http://www.codecapers.com/post.aspx?id=041a52e0-9820-4216-ab90-2aee3ee72269</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.codecapers.com/trackback.axd?id=041a52e0-9820-4216-ab90-2aee3ee72269</trackback:ping>
      <wfw:comment>http://www.codecapers.com/post/ASPNET-MVC-Unit-Testing-UpdateModel-and-TryUpdateModel.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.codecapers.com/syndication.axd?post=041a52e0-9820-4216-ab90-2aee3ee72269</wfw:commentRss>
    <feedburner:origLink>http://www.codecapers.com/post.aspx?id=041a52e0-9820-4216-ab90-2aee3ee72269</feedburner:origLink></item>
  </channel>
</rss>

