<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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" version="2.0">

<channel>
	<title>mhinze.com</title>
	
	<link>http://mhinze.com</link>
	<description>Matt Hinze's web log</description>
	<pubDate>Mon, 22 Sep 2008 23:25:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/mhinzecom" type="application/rss+xml" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.rojo.com/add-subscription?resource=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://blog.rojo.com/RojoWideRed.gif">Subscribe with Rojo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/mhinzecom" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item>
		<title>Passing objects to SubControllers</title>
		<link>http://mhinze.com/passing-objects-to-subcontrollers/</link>
		<comments>http://mhinze.com/passing-objects-to-subcontrollers/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 23:20:43 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[aspnetmvc]]></category>

		<category><![CDATA[mocking]]></category>

		<category><![CDATA[mvc]]></category>

		<category><![CDATA[subcontroller]]></category>

		<category><![CDATA[subcontrollers]]></category>

		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=107</guid>
		<description><![CDATA[SubControllers are MVC Controllers that are also parameters to your action methods.&#160; Incorporating their use in large systems allows for composition, dependency inversion, and separation of concerns.
Sometimes we want Controller actions to pass objects into SubControllers so that the SubControllers can do interesting things with them.&#160; 
For example, in a Product Controller we have the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mhinze.com/subcontrollers-in-aspnet-mvc/" >SubControllers are MVC Controllers that are also parameters to your action methods</a>.&nbsp; Incorporating their use in large systems allows for composition, dependency inversion, and separation of concerns.</p>
<p>Sometimes we want Controller actions to pass objects into SubControllers so that the SubControllers can do interesting things with them.&nbsp; </p>
<p>For example, in a Product Controller we have the Product, and in a SubController we want to find a few Customers that have recently purchased that Product.&nbsp; We don&#039;t want to call the Customer Repository in the Product Controller - instead we want to pass the Product to the SubController and let it handle talking to the Customer Repository.</p>
<p>It&#039;s easy to give the SubController a public property that the host Controller action can set.</p>
<pre class="code"><span style="color: blue">public interface </span><span style="color: #2b91af">ISubController</span>&lt;T&gt; : <span style="color: #2b91af">ISubController
</span>{
    T Model { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
}

<span style="color: blue">public abstract class </span><span style="color: #2b91af">SubController</span>&lt;T&gt; : <span style="color: #2b91af">SubController</span>, <span style="color: #2b91af">ISubController</span>&lt;T&gt;
{
    <span style="color: blue">public virtual </span>T Model { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
}</pre>
<p>To test this we need to be able to mock the RecentCustomersStubController so that we can assert that Model was set with the product object. </p>
<pre class="code">[<span style="color: #2b91af">Test</span>]
<span style="color: blue">public void </span>Should_set_Model_property_of_SubController_with_product()
{
    <span style="color: blue">var </span>product = <span style="color: blue">new </span><span style="color: #2b91af">Product</span>();
    <span style="color: blue">var </span>subcontroller = <span style="color: #2b91af">MockRepository</span>.GenerateMock&lt;<span style="color: #2b91af">IRecentCustomersSubController</span>&gt;();
    <span style="color: blue">var </span>controller = <span style="color: blue">new </span><span style="color: #2b91af">ProductController</span>();

    controller.List(product, subcontroller);

    subcontroller.AssertWasCalled(s =&gt; s.Model = product);
}</pre>
<p>To create a mock (with Rhino Mocks) we need to extract an interface from the SubController:</p>
<p><a href="http://11011.net/software/vspaste" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://11011.net/software/vspaste');"></a>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">ProductController </span>: <span style="color: #2b91af">Controller
</span>{
    <span style="color: blue">public </span><span style="color: #2b91af">ViewResult </span>List(<span style="color: #2b91af">Product </span>product, <span style="color: #2b91af">IRecentCustomersSubController </span>recentCustomers)
    {
        recentCustomers.Model = product;
        <span style="color: blue">return </span>View();
    }
}

<span style="color: blue">public interface </span><span style="color: #2b91af">IRecentCustomersSubController </span>: <span style="color: #2b91af">ISubController</span>&lt;<span style="color: #2b91af">Product</span>&gt; { }

<span style="color: blue">public class </span><span style="color: #2b91af">RecentCustomersSubController </span>: <span style="color: #2b91af">SubController</span>&lt;<span style="color: #2b91af">Product</span>&gt;, <span style="color: #2b91af">IRecentCustomersSubController
</span>{
    <span style="color: blue">private readonly </span><span style="color: #2b91af">ICustomerRepository </span>_customerRepository;

    <span style="color: blue">public </span>RecentCustomersSubController(<span style="color: #2b91af">ICustomerRepository </span>customerRepository)
    {
        _customerRepository = customerRepository;
    }

    <span style="color: blue">public </span><span style="color: #2b91af">ViewResult </span>RecentCustomers()
    {
        <span style="color: #2b91af">Customer</span>[] recentCustomers = _customerRepository.GetRecentCustomersOfProduct(Model);
        ViewData.Add(recentCustomers);
        <span style="color: blue">return </span>View();
    }
}</pre>
<pre class="code">&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/passing-objects-to-subcontrollers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SubControllers in ASP.NET MVC</title>
		<link>http://mhinze.com/subcontrollers-in-aspnet-mvc/</link>
		<comments>http://mhinze.com/subcontrollers-in-aspnet-mvc/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 02:09:36 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[c#]]></category>

		<category><![CDATA[mvc]]></category>

		<category><![CDATA[subcontrollers]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=98</guid>
		<description><![CDATA[I should have known something was up when I caught Jeffrey Palermo (my boss at Headspring) browsing the ASP.NET MVC Preview 5 source. 
We&#039;re working on a enterprise web application using ASP.NET MVC.&#160; That week one of our tasks was to create a rather complex page full of robust components that did intricate little things [...]]]></description>
			<content:encoded><![CDATA[<p>I should have known something was up when I caught <a href="http://www.jeffreypalermo.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.jeffreypalermo.com/');">Jeffrey Palermo</a> (my boss at <a href="http://headspringsystems.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://headspringsystems.com/');">Headspring</a>) browsing the ASP.NET MVC Preview 5 source. </p>
<p>We&#039;re working on a enterprise web application using ASP.NET MVC.&nbsp; That week one of our tasks was to create a rather complex page full of robust components that did intricate little things like field-level security.&nbsp; We wanted the ability to push behavior decisions to smaller and smaller pieces, and reuse those pieces on other pages.&nbsp; We needed testability, dependency injection and minimal friction.&nbsp; We needed composition.</p>
<p>Since I have been (hardly) working on components of <a href="http://codecampserver.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://codecampserver.org');">CodeCampServer</a> and hanging out with others interested in MVC I had heard about these SubController things.&nbsp; &#034;We need SubControllers!&#034; and &#034;When <strong>they</strong> finally put in SubControllers we can do X!&#034; &#034;RenderAction is troublesome because of Y and partials are limited for reasons of Z!&#034;</p>
<p>Admittedly I had no idea what they were talking about, but I sort of fell in line and waited for something cool to come out of Redmond. </p>
<p>Still, since he&#039;s literally writing <a href="http://manning.com/palermo/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://manning.com/palermo/');">the book on ASP.NET MVC</a>, I shouldn&#039;t have been surprised when after a few hours of keyboard clicking Jeffrey looked up and said, &#034;Hey, I just committed SubControllers.&#034;</p>
<p>Then a few days later he wrote a <a href="http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a#" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a#');">sample application and sent some info to the MvcContrib mailing list</a>.&nbsp; He&#039;s been heads-down on our project and I&#039;ve seen a few questions online about how to create reusable components in ASP.NET MVC, so I asked Jeffrey if I could do a write-up here.&nbsp; To be clear, I didn&#039;t invent, write, or even imagine SubControllers.. it&#039;s all Jeffrey&#8230; but I have been using them with success for a few weeks.</p>
<p>You may want to <a href="http://mvccontrib.googlecode.com/svn/trunk/src/Samples/MvcContrib.Samples.SubControllers/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/Samples/MvcContrib.Samples.SubControllers/');">check out the sample</a> before I dive into the details.&nbsp; </p>
<p>Here&#039;s a few screenshots of the sample in action.&nbsp; The rendered page (each component there is rendered by an isolated SubController&#039;s action) :</p>
<p><a href="http://mhinze.com/wp-content/uploads/2008/09/image4.png" ><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="184" alt="image" src="http://mhinze.com/wp-content/uploads/2008/09/image-thumb.png" width="383" border="0"></a></p>
<p>A nested SubController: </p>
<p><a href="http://mhinze.com/wp-content/uploads/2008/09/image5.png" ><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="159" alt="image" src="http://mhinze.com/wp-content/uploads/2008/09/image-thumb1.png" width="504" border="0"></a>&nbsp;</p>
<h4>What is this &#034;SubController&#034;?</h4>
<ul>
<li>Derives from SubController which derives from Controller and implements an ISubController interface.&nbsp; But it is a controller, so it:
<ul>
<li>has its own view - works just like regular controller with standard conventions
<li>has siloed ViewData - it does not share with other controllers
<li>has access to query string and the rest of the controller context</li>
</ul>
<li>Provides a System.Action (a delegate) that can be placed into ViewData and rendered in the host view with a call to Invoke()
<li>Is a parameter on action methods in your hosting controllers
<li>Can be infinitely nested
<li>Is constructed with an IModelBinder that spins up an instance from the container </li>
</ul>
<p>So let&#039;s take each of these in turn.</p>
<h4>How it works</h4>
<p>First, a look at the <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/ISubController.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/ISubController.cs');">ISubController</a> interface:</p>
<pre class="code"><span style="color: blue">public interface </span><span style="color: #2b91af">ISubController </span>: <span style="color: #2b91af">IController
</span>{
    <span style="color: #2b91af">Action </span>GetResult(<span style="color: #2b91af">ControllerBase </span>parentController);
}</pre>
<p>Pretty straight forward.&nbsp; It&#039;s a method named GetResult that takes a <a href="http://msmvps.com/blogs/luisabreu/archive/2008/09/08/the-mvc-framework-the-controller-lifecycle-ii.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://msmvps.com/blogs/luisabreu/archive/2008/09/08/the-mvc-framework-the-controller-lifecycle-ii.aspx');">ControllerBase</a> parameter and returns an Action.</p>
<p>Here is the <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SubController.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SubController.cs');">SubController class</a>&#039; implementation of that method:</p>
<pre class="code"><span style="color: blue">public virtual </span><span style="color: #2b91af">Action </span>GetResult(<span style="color: #2b91af">ControllerBase </span>parentController)
{
    <span style="color: #2b91af">RequestContext </span>requestContext = GetNewRequestContextFromController(parentController);
    <span style="color: blue">return </span>() =&gt; Execute(requestContext);
}</pre>
<p>Ok.&nbsp; Now we are getting somewhere.&nbsp; This <a href="http://msdn.microsoft.com/en-us/library/system.action.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://msdn.microsoft.com/en-us/library/system.action.aspx');">System.Action</a> is a delegate with no arguments and a return type of void.&nbsp; What it&#039;s actually doing is encapsulating a regular Controller&#039;s Execute method.&nbsp; Which pops off the controller action method: stuffs ViewData and renders the View and all that.&nbsp; The parameterless delegate Action is new in .NET 3.5 (though Action&lt;T&gt; was introduced in .NET 2.0).</p>
<p>Anyway, that&#039;s the real meaty bit of SubControllers: <strong>providing a delegate that can be put into ViewData</strong>.</p>
<p>So the next thing that has to happen is the delegate has to be created to represent the SubController&#039;s action method (that returns an ActionResult). This is where we start using the convention of naming the SubController&#039;s action method in an obvious way. We&#039;ll come back to this convention.</p>
<p>Let&#039;s take a look at the rest of the SubController class:</p>
<pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">RequestContext </span>GetNewRequestContextFromController(<span style="color: #2b91af">ControllerBase </span>parentController)
{
    <span style="color: #2b91af">RouteData </span>parentRouteData = parentController.ControllerContext.RouteData;
    <span style="color: blue">var </span>routeData = <span style="color: blue">new </span><span style="color: #2b91af">RouteData</span>(parentRouteData.Route, parentRouteData.RouteHandler);
    <span style="color: blue">string </span>controllerName = GetControllerName();
    routeData.Values[<span style="color: #a31515">"controller"</span>] = controllerName;
    routeData.Values[<span style="color: #a31515">"action"</span>] = controllerName;
    <span style="color: blue">return new </span><span style="color: #2b91af">RequestContext</span>(parentController.ControllerContext.HttpContext, routeData);
}

<span style="color: blue">public string </span>GetControllerName()
{
    <span style="color: blue">return </span>GetType().Name.ToLowerInvariant().Replace(<span style="color: #a31515">"subcontroller"</span>, <span style="color: #a31515">""</span>).Replace(<span style="color: #a31515">"controller"</span>, <span style="color: #a31515">""</span>);
}</pre>
<p><a href="http://11011.net/software/vspaste" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://11011.net/software/vspaste');"></a><a href="http://11011.net/software/vspaste" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://11011.net/software/vspaste');"></a></p>
<p>The important thing to note is that the GetControllerName() method returns the part of the controller name minus the word &#034;controller&#034; and &#034;subcontroller&#034;.&nbsp; So if your SubController is named ProductDetailSubController that method would return &#034;ProductDetail&#034;.</p>
<p>The other important thing to note is that in the GetNewRequestContextFromController(&#8230;) method the action key of the routeData is set to this same value.&nbsp; In our example, &#034;ProductDetail&#034; is the action. </p>
<p>When the SubController&#039;s delegate is eventually invoked it will execute a method on the SubController with the name &#034;ProductDetail&#034;.</p>
<p><strong>Therefore the convention is to use an action method with the same name as the SubController (minus the text &#034;subcontroller&#034; or &#034;controller&#034;).</strong></p>
<p>So far we see that SubControllers give us a delegate (System.Action) that represents an invocation of its method with the conventional name.</p>
<h4>Hello SubControllers</h4>
<p>Let&#039;s take a quick detour to see what a SubController might look like:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">FirstLevelSubController </span>: <span style="color: #2b91af">SubController
</span>{
    <span style="color: blue">public </span><span style="color: #2b91af">ViewResult </span>FirstLevel()
    {
        ViewData[<span style="color: #a31515">"text"</span>] = <span style="color: #a31515">"I am a first level controller"</span>;
        <span style="color: blue">return </span>View();
    }
}</pre>
<p>This is straight out of Jeffrey&#039;s example.&nbsp; Looks just like a regular controller except it derives from SubController and has one action method with the conventional name. FirstLevelSubController&#039;s GetResult() will return a delegate that represents the FirstLevel() method.</p>
<p>By the way, you test SubControllers exactly the same way as you would regular controllers: execute the action method and assert that the ActionResult is in the proper state with the correct ViewData and ViewName.</p>
<h4>Using SubControllers from host Controllers</h4>
<p>Now that we have the System.Action delegate we need to get it into ViewData.&nbsp; This is how I started out doing it:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">HomeController </span>: <span style="color: #2b91af">Controller
</span>{
    <span style="color: blue">public </span><span style="color: #2b91af">ActionResult </span>Index(<span style="color: #2b91af">FirstLevelSubController </span>firstLevel)
    {
        ViewData[<span style="color: #a31515">"firstLevel"</span>] = firstLevel.GetResult(<span style="color: blue">this</span>);
        <span style="color: blue">return </span>View();
    }
}</pre>
<p>&#8230; and so on, and so on, for each SubController in the parameter list.&nbsp; This works fine.&nbsp; The System.Action gets put in ViewData and we can invoke it from the view just like we expect.&nbsp; Testing it is straightforward as well, just mock the SubController and expect that its action gets put in ViewData:</p>
<pre class="code">[<span style="color: #2b91af">Test</span>]
<span style="color: blue">public void </span>Index_puts_subcontroller_action_into_viewdata()
{
    <span style="color: blue">var </span>controller = <span style="color: blue">new </span><span style="color: #2b91af">HomeController</span>();
    <span style="color: blue">var </span>firstLevelSubController = <span style="color: #2b91af">MockRepository</span>.GenerateStub&lt;<span style="color: #2b91af">FirstLevelSubController</span>&gt;();
    <span style="color: #2b91af">Action </span>stubAction = () =&gt; { };
    firstLevelSubController.Stub(sub =&gt; sub.GetResult(controller)).Return(stubAction);

    <span style="color: blue">var </span>result = controller.Index(firstLevelSubController) <span style="color: blue">as </span><span style="color: #2b91af">ViewResult</span>;

    <span style="color: #2b91af">Assert</span>.That(result.ViewData.Get&lt;<span style="color: #2b91af">Action</span>&gt;(<span style="color: #a31515">"firstLevel"</span>), <span style="color: #2b91af">Is</span>.EqualTo(stubAction));
}</pre>
<p>Yeah, straight forward as in straight forward but not as in easy or concise (especially when it comes to actions that depend on <em>many</em> SubControllers - imagine 5 or 7 or 10 stubs in there..)..</p>
<h4>Going frictionless</h4>
<p>Enter the <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/Filters/SubControllerActionToViewDataAttribute.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/Filters/SubControllerActionToViewDataAttribute.cs');">SubControllerActionToViewDataAttribute</a>!&nbsp; This <a href="http://weblogs.asp.net/scottgu/archive/2008/07/14/asp-net-mvc-preview-4-release-part-1.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://weblogs.asp.net/scottgu/archive/2008/07/14/asp-net-mvc-preview-4-release-part-1.aspx');">ActionFilterAttribute</a> cycles through the host action&#039;s parameters (filterContext.ActionParameters - a neat trick) and puts each SubController parameter&#039;s System.Action into ViewData:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">SubControllerActionToViewDataAttribute </span>: <span style="color: #2b91af">ActionFilterAttribute
</span>{
    <span style="color: blue">public override void </span>OnActionExecuting(<span style="color: #2b91af">ActionExecutingContext </span>filterContext)
    {
        <span style="color: blue">foreach </span>(<span style="color: blue">var </span>pair <span style="color: blue">in </span>filterContext.ActionParameters)
        {
            <span style="color: blue">object </span>value = pair.Value;
            <span style="color: blue">if</span>(value == <span style="color: blue">null</span>)
            {
                <span style="color: blue">continue</span>;
            }

            <span style="color: blue">if </span>(<span style="color: blue">typeof</span>(<span style="color: #2b91af">ISubController</span>).IsAssignableFrom(value.GetType()))
            {
                <span style="color: blue">var </span>controller = (<span style="color: #2b91af">ISubController</span>) value;
                filterContext.Controller.ViewData.Add(pair.Key, controller.GetResult(filterContext.Controller));
            }
        }

        <span style="color: blue">base</span>.OnActionExecuting(filterContext);
    }
}</pre>
<p>We have added a second convention: <strong>the SubController&#039;s parameter variable name (pair.Key above) is the key of the respective System.Action in ViewData.</strong></p>
<p>The concern now becomes testing that the attribute works and that the your controllers have the attribute, not testing that individual SubController&#039;s System.Actions are put in ViewData. <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib.UnitTests/Filters/SubControllerActionToViewDataAttributeTester.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib.UnitTests/Filters/SubControllerActionToViewDataAttributeTester.cs');">These tests are in MvcContrib</a>. This frees developers from the weight of having to write cumbersome tests.</p>
<p>In fact, the <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SubController.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SubController.cs');">SubController base class in MvcContrib</a> has this attribute allowing for infinite nesting.</p>
<h4>&#034;Calling&#034; the SubController from the view</h4>
<p>Once we pop that System.Action delegate into ViewData we can invoke it straight from the host action&#039;s view:</p>
<pre class="code"><span style="background: #ffee62">&lt;%</span> ViewData.Get&lt;<span style="color: #2b91af">Action</span>&gt;(<span style="color: #a31515">"firstLevel"</span>).Invoke(); <span style="background: #ffee62">%&gt;</span></pre>
<p>The strong-typed <a href="http://codebetter.com/blogs/jeffrey.palermo/archive/2008/03/26/asp-net-mvc-goodbye-smartbag-hello-viewdataextensions.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://codebetter.com/blogs/jeffrey.palermo/archive/2008/03/26/asp-net-mvc-goodbye-smartbag-hello-viewdataextensions.aspx');">Get&lt;T&gt;() method is another feature</a> <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/ViewDataExtensions.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/ViewDataExtensions.cs');">built into MvcContrib</a>.</p>
<h4>Dependency injection</h4>
<p>Finally, we definitely need rich dependency injection support in these SubControllers. <a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16775" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16775');">MVC Preview 5</a> introduced the <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx');">IModelBinder</a> interface that is responsible for constructing action parameters.&nbsp; We can add them in Global.asax or wherever the controllers are constructed:</p>
<pre class="code"><span style="color: blue">protected void </span>Application_Start()
{
    RegisterRoutes(<span style="color: #2b91af">RouteTable</span>.Routes);
    <span style="color: #2b91af">ModelBinders</span>.DefaultBinder = <span style="color: blue">new </span><span style="color: #2b91af">SubControllerBinder</span>();
}</pre>
<p>Here is the basic implementation of <a href="http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/Binders/SubControllerBinder.cs" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/Binders/SubControllerBinder.cs');">SubControllerBinder in MvcContrib</a>:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">SubControllerBinder </span>: <span style="color: #2b91af">DefaultModelBinder
</span>{
    <span style="color: blue">protected override object </span>ConvertType(<span style="color: #2b91af">CultureInfo </span>culture, <span style="color: blue">object </span>value, <span style="color: #2b91af">Type </span>destinationType)
    {
        <span style="color: blue">if </span>(<span style="color: blue">typeof </span>(<span style="color: #2b91af">ISubController</span>).IsAssignableFrom(destinationType))
        {
            <span style="color: blue">object </span>instance = CreateSubController(destinationType);
            <span style="color: blue">if </span>(instance == <span style="color: blue">null</span>)
            {
                <span style="color: blue">throw new </span><span style="color: #2b91af">InvalidOperationException</span>(destinationType + <span style="color: #a31515">" not created properly."</span>);
            }

            <span style="color: blue">return </span>instance;
        }

        <span style="color: blue">return base</span>.ConvertType(culture, value, destinationType);
    }

    <span style="color: gray">///&lt;summary&gt;
    /// </span><span style="color: green">Creates the subcontroller given its type.  Override this method to wire into an IoC container
    </span><span style="color: gray">///&lt;/summary&gt;
    ///&lt;param name="destinationType"&gt;</span><span style="color: green">The type of subcontroller</span><span style="color: gray">&lt;/param&gt;
    ///&lt;returns&gt;</span><span style="color: green">an object instance</span><span style="color: gray">&lt;/returns&gt;
    </span><span style="color: blue">public virtual object </span>CreateSubController(<span style="color: #2b91af">Type </span>destinationType)
    {
        <span style="color: blue">return </span><span style="color: #2b91af">Activator</span>.CreateInstance(destinationType, <span style="color: blue">true</span>);
    }
}</pre>
<p>And you can wire this up to a container with ease:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">StructureMapSubControllerBinder </span>: <span style="color: #2b91af">SubControllerBinder
</span>{
    <span style="color: blue">public override object </span>CreateSubController(<span style="color: #2b91af">Type </span>destinationType)
    {
        <span style="color: blue">object </span>instance = <span style="color: #2b91af">ObjectFactory</span>.GetInstance(destinationType);
        <span style="color: blue">if </span>(instance == <span style="color: blue">null</span>)
        {
            <span style="color: blue">throw new </span><span style="color: #2b91af">InvalidOperationException</span>(destinationType + <span style="color: #a31515">" not registered with StructureMap"</span>);
        }

        <span style="color: blue">return </span>instance;
    }
}</pre>
<p>So there you have it.&nbsp; You can <a href="http://mvccontrib.googlecode.com/svn/trunk/src/Samples/MvcContrib.Samples.SubControllers/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.googlecode.com/svn/trunk/src/Samples/MvcContrib.Samples.SubControllers/');">download and explore a complete working sample from MvcContrib</a>.&nbsp; If you have a suggestion for improvement <a href="http://mvccontrib.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mvccontrib.org');">MvcContrib</a> is accepting patches.&nbsp; I have a few more posts in the queue about some intermediate usages and testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/subcontrollers-in-aspnet-mvc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A few thoughts</title>
		<link>http://mhinze.com/thoughts2/</link>
		<comments>http://mhinze.com/thoughts2/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 22:29:21 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Deep thoughts]]></category>

		<category><![CDATA[Agile]]></category>

		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[aspnetmvc]]></category>

		<category><![CDATA[headspring]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[uml]]></category>

		<category><![CDATA[yagni]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=96</guid>
		<description><![CDATA[
Microsoft wants you to think of a web page as an action, but it&#039;s really a collection of subcontrollers.
Mahendra Mavani is one of the very talented software engineers working at Headspring and he knows all the obscure Resharper shortcuts (serious geek cred).
Coding is an indulgent, wasteful activity.&#160; Design is best done away from the keyboard.&#160; [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Microsoft wants you to think of a web page as an <strong>action</strong>, but it&#039;s really a <a href="http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a');">collection of subcontrollers</a><strong>.</strong>
<li><a href="http://mahendramavani.blogspot.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mahendramavani.blogspot.com/');">Mahendra Mavani</a> is one of the very talented software engineers working at Headspring and he knows all the obscure Resharper shortcuts (serious geek cred).
<li>Coding is an indulgent, wasteful activity.&nbsp; Design is best done away from the keyboard.&nbsp; Sure, once we get to writing tests and writing code things change, but for a general understanding nothing works better than a whiteboard, pseudo-UML and sequence diagrams.
<li>It&#039;s really, really easy to under-estimate and over-commit.&nbsp; Under estimating is the default.&nbsp; It&#039;s much harder to under-promise and over-deliver because that requires technical experience <strong>along with</strong> people-skills.
<li>Conventions enable rapid development.&nbsp; Following them takes discipline.
<li><a href="http://www.ayende.com/Blog/archive/2008/08/27/JFHCI-Quote-of-the-Day.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.ayende.com/Blog/archive/2008/08/27/JFHCI-Quote-of-the-Day.aspx');">JFHCI</a>: look for ways to do this.&nbsp; YAGNI takes discipline - this fact is counterintuitive.&nbsp;
<li>100% code coverage isn&#039;t important in and of itself, but as a track on which to glide towards the goal of well designed software, nothing works better.
<li>Stack Overflow .com is pretty sweet, and fun.&nbsp; Except for all the regular internet discussion problems.
<li>There&#039;s a certain sweet satisfaction in the progress of story cards from left to right.&nbsp; If you aren&#039;t being transparent in your work (up and down the org. structure)&#8230; try it. It&#039;s truly refreshing.
<li>Austin is a great town for software.&nbsp; AgileATX, ADNUG, etc.&nbsp; Lots of cool and smart people to hang out with and talk to about our [a]vocation. </ul>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/thoughts2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How we work: user story execution process</title>
		<link>http://mhinze.com/user-story-execution-process/</link>
		<comments>http://mhinze.com/user-story-execution-process/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 22:08:09 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Agile]]></category>

		<category><![CDATA[headspring]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=94</guid>
		<description><![CDATA[ 
User Story Execution Process

Select (story &#124; task) from story wall
Move task card to &#034;In Progress&#034; column
Model code that needs to be written (use object model and sequence diagrams)
Create technical tasks needed for completion
Get team member to review design
Mark each technical task as &#034;pair&#034; or &#034;single&#034;
Test-drive code to completion according to design.&#160; Commit changes along [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="522" alt="user-story-execution-process" src="http://mhinze.com/wp-content/uploads/2008/09/user-story-execution-process.jpg" width="504" border="0"> </p>
<p><u>User Story Execution Process</u></p>
<ul>
<li>Select (story | task) from story wall</li>
<li>Move task card to &#034;In Progress&#034; column</li>
<li>Model code that needs to be written (use object model and sequence diagrams)</li>
<li>Create technical tasks needed for completion</li>
<li>Get team member to review design</li>
<li>Mark each technical task as &#034;pair&#034; or &#034;single&#034;</li>
<li>Test-drive code to completion according to design.&nbsp; Commit changes along the way to enable concurrent development.</li>
</ul>
<p>I will leave this without commentary for now, except that: it is working quite well.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/user-story-execution-process/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Obligatory Utility Roundup Post</title>
		<link>http://mhinze.com/obligatory-utility-roundup-post/</link>
		<comments>http://mhinze.com/obligatory-utility-roundup-post/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 05:08:27 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://mhinze.com/obligatory-utility-roundup-post/</guid>
		<description><![CDATA[I have set up a few new PCs lately in the course of getting set up on my new job.&#160; Here is what I install:

Windows XP SP3 - Vista too much friction

Use BlackViper&#039;s Safe config
Turn off System Restore
Pop a shortcut to Start Menu in my SendTo folder for easy/lazy Launchy indexing)
Set up my folder views [...]]]></description>
			<content:encoded><![CDATA[<p>I have set up a few new PCs lately in the course of getting set up on <a href="http://mhinze.com/joined-headspring/" >my new job</a>.&#160; Here is what I install:</p>
<ul>
<li>Windows XP SP3 - Vista too much friction</li>
<ul>
<li>Use <a href="http://www.blackviper.com/WinXP/servicecfg.htm" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.blackviper.com/WinXP/servicecfg.htm');">BlackViper</a>&#039;s Safe config</li>
<li><a href="http://support.microsoft.com/kb/310405" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://support.microsoft.com/kb/310405');">Turn off System Restore</a></li>
<li>Pop a shortcut to Start Menu in my SendTo folder for easy/lazy Launchy indexing)</li>
<li>Set up my folder views and apply to all folders:</li>
</ul>
</ul>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="317" alt="image" src="http://mhinze.com/wp-content/uploads/2008/09/image.png" width="582" border="0" />&#160;</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="468" alt="image" src="http://mhinze.com/wp-content/uploads/2008/09/image1.png" width="386" border="0" /></p>
<ul>
<li>Windows XP continued</li>
<ul>
<li>Set up Windows Classic Theme and turn off any fancy UI stuff like animations</li>
</ul>
</ul>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="448" alt="image" src="http://mhinze.com/wp-content/uploads/2008/09/image2.png" width="404" border="0" /> </p>
<ul>
<li>Windows XP continued</li>
<ul>
<li> Setup toolbar to locked with just the Show Desktop shortcut</li>
</ul>
</ul>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="44" alt="image" src="http://mhinze.com/wp-content/uploads/2008/09/image3.png" width="145" border="0" />&#160;</p>
<ul>
<li><a href="http://launchy.net" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://launchy.net');">Launchy</a> - gotta have it</li>
<li><a href="http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe');">Virtual CD ROM Control Panel</a> - mount ISOs</li>
<li>SQL Server 2005 Developer</li>
<li>Visual Studio 2008 Pro</li>
<li>.NET 3.5 SP1</li>
<li>Windows Update including IE 7 and whatever Media Player they have</li>
<li><a href="http://tortoisesvn.net/downloads" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://tortoisesvn.net/downloads');">Tortoise SVN</a> (reboot here)</li>
<li>ASP.NET MVC</li>
<li><a href="http://getfirefox.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://getfirefox.com/');">Firefox 3</a></li>
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1865" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/en-US/firefox/addon/1865');">Adblock Plus</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/6076" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/en-US/firefox/addon/6076');">Better Gmail 2</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/3615" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/en-US/firefox/addon/3615');">Delicious Bookmarks</a></li>
<li><a href="http://www.foxmarks.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.foxmarks.com/');">Foxmarks</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/4287" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/en-US/firefox/addon/4287');">Split Browser</a></li>
<li><a href="http://tmp.garyr.net/dev-builds/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://tmp.garyr.net/dev-builds/');">Tab Mix Plus dev build</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/en-US/firefox/addon/1843');">Firebug</a></li>
</ul>
<li><a href="http://www.red-gate.com/products/reflector/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.red-gate.com/products/reflector/');">Reflector</a></li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=71179&amp;package_id=83198" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://sourceforge.net/project/showfiles.php?group_id=71179&amp;package_id=83198');">CCTray</a></li>
<li><a href="http://www.microsoft.com/typography/ClearTypePowerToy.mspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.microsoft.com/typography/ClearTypePowerToy.mspx');">ClearType</a></li>
<li><a href="http://www.proggyfonts.com/index.php?menu=download" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.proggyfonts.com/index.php?menu=download');">Proggy Clean</a> - font</li>
<li><a href="http://www.foxitsoftware.com/downloads/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.foxitsoftware.com/downloads/');">Foxit</a></li>
<li><a href="http://www.google.com/talk/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.google.com/talk/');">Google Talk</a> - the only IM client that delivers searchable logs in my Gmail - required.</li>
<li><a href="http://notepad-plus.sourceforge.net/uk/download.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://notepad-plus.sourceforge.net/uk/download.php');">Notepad++</a></li>
<li><a href="http://www.visualsvn.com/visualsvn/download/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.visualsvn.com/visualsvn/download/');">VisualSVN</a></li>
<li><a href="http://www.testdriven.net/download.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.testdriven.net/download.aspx');">Testdriven.NET</a> - map run tests to Ctrl-T</li>
<li><a href="http://labs.adobe.com/downloads/air.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://labs.adobe.com/downloads/air.html');">AIR</a> / <a href="http://www.twhirl.org/project/twhirl" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.twhirl.org/project/twhirl');">Twhirl</a> - to waste time</li>
<li><a href="http://www.getpaint.net/download.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.getpaint.net/download.html');">Paint.NET</a></li>
<li><a href="http://www.getpaint.net/download.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.getpaint.net/download.html');">Resharper</a></li>
<li><a href="http://get.live.com/writer/overview" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://get.live.com/writer/overview');">Windows Live Writer</a></li>
<li><a href="http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;l=8" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;l=8');">Paste from Visual Studio</a> (WLW plugin)</li>
<li><a href="http://www.7-zip.org/download.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.7-zip.org/download.html');">7-Zip</a></li>
<li><a href="http://www.codeplex.com/Terminals" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.codeplex.com/Terminals');">Terminals</a></li>
<li><a href="http://sourceforge.net/projects/console/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://sourceforge.net/projects/console/');">Console2</a></li>
<li><a href="http://filezilla-project.org/download.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://filezilla-project.org/download.php');">FileZilla</a></li>
<li><a href="http://pages.interlog.com/~tcharron/wgetwin.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pages.interlog.com/~tcharron/wgetwin.html');">wget</a></li>
<li><a href="http://www.fiddlertool.com/fiddler/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.fiddlertool.com/fiddler/');">Fiddler</a></li>
<li><a href="http://gnuwin32.sourceforge.net/packages/grep.htm" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://gnuwin32.sourceforge.net/packages/grep.htm');">grep</a></li>
<li><a href="http://www.utorrent.com/download.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.utorrent.com/download.php');">&#181;Torrent</a></li>
<li><a href="http://www.xvid.org/Downloads.15.0.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.xvid.org/Downloads.15.0.html');">xvid codec</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/obligatory-utility-roundup-post/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Self-signed SSL Certs on IIS 6 part 2</title>
		<link>http://mhinze.com/self-signed-ssl-cert-iis-6-part-2/</link>
		<comments>http://mhinze.com/self-signed-ssl-cert-iis-6-part-2/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 03:52:38 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[certificate]]></category>

		<category><![CDATA[iis]]></category>

		<category><![CDATA[self]]></category>

		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=82</guid>
		<description><![CDATA[Q: How do I install self-signed SSL certificates on two IIS 6 websites on the same server where both sites use port 443 and are configured with host headers?
A: Multiple SSL sites on a single IIS server using host headers.&#160; &#60;- the answer.&#160; 
Basically, use SelfSSL or SSLDiag to create a cert with CN=*.example.com, then [...]]]></description>
			<content:encoded><![CDATA[<p>Q: How do I install self-signed SSL certificates on <strong>two</strong> IIS 6 websites on the same server where both sites use port 443 and are configured with host headers?</p>
<p>A: <a href="http://lanestechblog.blogspot.com/2008/03/creating-self-signed-wildcard-ssl.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://lanestechblog.blogspot.com/2008/03/creating-self-signed-wildcard-ssl.html');">Multiple SSL sites on a single IIS server using host headers</a>.&#160; &lt;- the answer.&#160; </p>
<p>Basically, use SelfSSL or SSLDiag to create a cert with CN=*.example.com, then just point the second site to that cert in the Directory Security tab.&#160; Also, configure secure server bindings using adsutil (found in c:\inetpub\adminscripts).</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/self-signed-ssl-cert-iis-6-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgraded to Preview 5</title>
		<link>http://mhinze.com/upgraded-to-preview-5/</link>
		<comments>http://mhinze.com/upgraded-to-preview-5/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 03:41:57 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[aspnetmvc]]></category>

		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=79</guid>
		<description><![CDATA[ASP.NET MVC Preview 5 dropped a few days ago and I upgraded my apps today.&#160; Just a few minor notes on the process, which was painless. Most changes are covered in the release notes.

RenderUserControl is now RenderPartial
Asserting that Controller.View() was called now looks like:

Assert.That(viewResult.ViewName, Is.EqualTo(string.Empty));


Some HtmlHelper changes.&#160; Some are great but the behavior of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16775#ReleaseFiles" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16775#ReleaseFiles');">ASP.NET MVC Preview 5</a> dropped a few days ago and I upgraded my apps today.&#160; Just a few minor notes on the process, which was painless. Most changes are covered in the <a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16775" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16775');">release notes</a>.</p>
<ul>
<li>RenderUserControl is now RenderPartial</li>
<li>Asserting that Controller.View() was called now looks like:</li>
</ul>
<pre class="code"><span style="color: #2b91af">Assert</span>.That(viewResult.ViewName, <span style="color: #2b91af">Is</span>.EqualTo(<span style="color: blue">string</span>.Empty));</pre>
<p><a href="http://11011.net/software/vspaste" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://11011.net/software/vspaste');"></a></p>
<ul>
<li>Some HtmlHelper changes.&#160; Some are great but the behavior of the private method InputHelper has me a bit perplexed.&#160; It outputs a hidden input for holding the value of checkboxes. This violates a big selling point of ASP.NET MVC in the first place: it won&#039;t write unexpected HTML.&#160; I guess I&#039;ll be writing a lot of these guys, but testing them is painful.. otherwise I wouldn&#039;t much care what came with the framework.</li>
<li>DefaultControllerFactory.CreateController() is now public</li>
<li>action filter contexts no longer take a MethodInfo object as constructor param..</li>
</ul>
<p>That&#039;s it from my log&#8230; again, pretty easy upgrade.&#160; I am still reviewing all the changes.&#160; Besides the HtmlHelper stuff I am excited about this drop.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/upgraded-to-preview-5/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Self-signed SSL certs on IIS 6</title>
		<link>http://mhinze.com/self-signed-ssl-certs-on-iis-6/</link>
		<comments>http://mhinze.com/self-signed-ssl-certs-on-iis-6/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 21:00:25 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[443]]></category>

		<category><![CDATA[certificate]]></category>

		<category><![CDATA[iis]]></category>

		<category><![CDATA[iis 6]]></category>

		<category><![CDATA[selfssl]]></category>

		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://mhinze.com/self-signed-ssl-certs-on-iis-6/</guid>
		<description><![CDATA[Q: How do I install a self-signed SSL certificate on an IIS 6 website?
A: Use the SelfSSL utility that comes with the IIS Resource kit!
http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx
&#160;
Q: How do I install self-signed SSL certificates on two IIS 6 websites on the same server?
A: SelfSSL.exe is bugged.&#160; Install SSLDiag and use its embedded SelfSSL tool.
The problem with two [...]]]></description>
			<content:encoded><![CDATA[<p>Q: How do I install a self-signed SSL certificate on an IIS 6 website?</p>
<p>A: Use the SelfSSL utility that comes with the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=56FC92EE-A71A-4C73-B628-ADE629C89499&amp;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.microsoft.com/downloads/details.aspx?familyid=56FC92EE-A71A-4C73-B628-ADE629C89499&amp;displaylang=en');">IIS Resource kit</a>!</p>
<p><a title="http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx" href="http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx');">http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx</a></p>
<p>&nbsp;</p>
<p>Q: How do I install self-signed SSL certificates on <strong>two</strong> IIS 6 websites on the same server?</p>
<p>A: SelfSSL.exe is bugged.&nbsp; Install <a href="http://www.microsoft.com/downloads/details.aspx?familyid=cabea1d0-5a10-41bc-83d4-06c814265282&amp;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.microsoft.com/downloads/details.aspx?familyid=cabea1d0-5a10-41bc-83d4-06c814265282&amp;displaylang=en');">SSLDiag</a> and use its embedded SelfSSL tool.</p>
<p>The problem with two certs, two sites on the same server is strange.&nbsp; You install a cert on website A and it works great.&nbsp; You install another cert on B and B works great while A breaks.&nbsp; And etc.</p>
<p><a title="http://ewright.spaces.live.com/blog/cns!C0C3DF24CE16DC2F!169.entry" href="http://ewright.spaces.live.com/blog/cns!C0C3DF24CE16DC2F!169.entry" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://ewright.spaces.live.com/blog/cns!C0C3DF24CE16DC2F!169.entry');">http://ewright.spaces.live.com/blog/cns!C0C3DF24CE16DC2F!169.entry</a></p>
<p>ssldiag /selfssl /V:365 /N:CN=www.point2.com /S:1834870997</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/self-signed-ssl-certs-on-iis-6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Glorifying Agile</title>
		<link>http://mhinze.com/glorifying-agile/</link>
		<comments>http://mhinze.com/glorifying-agile/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 02:51:05 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=71</guid>
		<description><![CDATA[As a student of Agile theory but not involved in team practice until recently, I happily acknowledge that my understanding is incomplete.&#160; But I was surprised to realize this week that one of the mind-sets contributing to my ignorance did not involve lack of practical experience, but rather a glorification of Agile.&#160; 
I had it [...]]]></description>
			<content:encoded><![CDATA[<p>As a student of Agile theory but not involved in team practice until recently, I happily acknowledge that my understanding is incomplete.&#160; But I was surprised to realize this week that one of the mind-sets contributing to my ignorance did not involve lack of practical experience, but rather a glorification of Agile.&#160; </p>
<p>I had it on a pedestal - shining, holy, even - a easy, breezy process in which things happened with little effort.&#160; Maybe I was confusing &#034;idealism&#034; from the reality of &#034;ideal&#034;.  I guess I&#039;m discovering what practitioners have known forever: Agile is anything but laissez faire.&#160; It requires serious mental discipline.&#160; The discipline and transparency involved is, to put it bluntly: more work.&#160; This is a good thing.&#160; </p>
<p>More work doesn&#039;t mean more difficult work, more ineffective work, more spinning of wheels - it means more tasks complete, less &quot;play time&quot;, and a more satisfying &quot;leaving work experience&quot;.&#160; Just don&#039;t let all that hard work surprise you.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/glorifying-agile/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Headspring</title>
		<link>http://mhinze.com/joined-headspring/</link>
		<comments>http://mhinze.com/joined-headspring/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 02:10:07 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Meta]]></category>

		<category><![CDATA[career]]></category>

		<category><![CDATA[headspring]]></category>

		<guid isPermaLink="false">http://mhinze.com/?p=66</guid>
		<description><![CDATA[On a personal note: I recently joined Headspring Systems in Austin.&#160; I have been presented with a great opportunity to learn and succeed.&#160; I feel very green but I&#039;m prepared to grow.&#160; And I&#039;ve already had the chance to observe first-hand liberating architectures, agile thinking, and expert code craft&#8230;
I do intend to learn in public, [...]]]></description>
			<content:encoded><![CDATA[<p>On a personal note: I <a href="http://twitter.com/mhinze/statuses/884844177" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://twitter.com/mhinze/statuses/884844177');">recently</a> joined <a href="http://www.headspringsystems.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.headspringsystems.com/');">Headspring Systems</a> in <a href="http://www.lostechies.com/blogs/chad_myers/archive/2008/04/21/move-to-austin.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.lostechies.com/blogs/chad_myers/archive/2008/04/21/move-to-austin.aspx');">Austin</a>.&#160; I have been presented with a great opportunity to learn and succeed.&#160; I feel very green but I&#039;m prepared to grow.&#160; And I&#039;ve already had the chance to observe first-hand liberating architectures, agile thinking, and expert code craft&#8230;</p>
<p>I do intend to learn in public, so <a href="http://feeds.feedburner.com/mhinzecom" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://feeds.feedburner.com/mhinzecom');">stay tuned</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/joined-headspring/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
