<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Context Variables in Ninject</title>
	<atom:link href="http://kohari.org/2008/03/13/context-variables-in-ninject/feed/" rel="self" type="application/rss+xml" />
	<link>http://kohari.org/2008/03/13/context-variables-in-ninject/</link>
	<description>Rambling and occasional wisdom from Nate Kohari</description>
	<lastBuildDate>Thu, 21 Jul 2011 13:50:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Haacked</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-88</link>
		<dc:creator><![CDATA[Haacked]]></dc:creator>
		<pubDate>Fri, 29 May 2009 21:07:27 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-88</guid>
		<description><![CDATA[If you don&#039;t need to change the default behavior for looking up controller types by name, there&#039;s a simpler option. Simply have your controller factory inherit from DefaultControllerFactory. Then in your CreateController method:

public override IController CreateController(RequestContext requestContext, string controllerName)
{
    IController controller = null;
    Type controllerType = base.GetControllerType(controllerName);
    if (controllerType != null) {
        controller = this.Kernel.Get(controllerType, new IParameter[0]) as IController;
    }
    return controller;
}

Note that I&#039;m simply calling into DefaultController&#039;s implementation for looking up the controller type based on the controller name. Once I have the type, then I call into Ninject. Saves a lot of work.]]></description>
		<content:encoded><![CDATA[<p>If you don&#8217;t need to change the default behavior for looking up controller types by name, there&#8217;s a simpler option. Simply have your controller factory inherit from DefaultControllerFactory. Then in your CreateController method:</p>
<p>public override IController CreateController(RequestContext requestContext, string controllerName)<br />
{<br />
    IController controller = null;<br />
    Type controllerType = base.GetControllerType(controllerName);<br />
    if (controllerType != null) {<br />
        controller = this.Kernel.Get(controllerType, new IParameter[0]) as IController;<br />
    }<br />
    return controller;<br />
}</p>
<p>Note that I&#8217;m simply calling into DefaultController&#8217;s implementation for looking up the controller type based on the controller name. Once I have the type, then I call into Ninject. Saves a lot of work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Dickinson</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-94</link>
		<dc:creator><![CDATA[Jonathan Dickinson]]></dc:creator>
		<pubDate>Mon, 06 Oct 2008 13:12:11 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-94</guid>
		<description><![CDATA[And I just noticed my angle brackets were stripped. Here we go again:

GetAs&lt;T&gt;(Type) where T : class
GetCastedTo&lt;T&gt;(Type)]]></description>
		<content:encoded><![CDATA[<p>And I just noticed my angle brackets were stripped. Here we go again:</p>
<p>GetAs&lt;T&gt;(Type) where T : class<br />
GetCastedTo&lt;T&gt;(Type)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Dickinson</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-93</link>
		<dc:creator><![CDATA[Jonathan Dickinson]]></dc:creator>
		<pubDate>Mon, 06 Oct 2008 13:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-93</guid>
		<description><![CDATA[Oops. I meant to type GetAs(Type) where T : class]]></description>
		<content:encoded><![CDATA[<p>Oops. I meant to type GetAs(Type) where T : class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Dickinson</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-92</link>
		<dc:creator><![CDATA[Jonathan Dickinson]]></dc:creator>
		<pubDate>Mon, 06 Oct 2008 13:06:17 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-92</guid>
		<description><![CDATA[I have a [very] small suggestion. How about creating a little more syntactic sugar. Currently your Get(Type) method returns an object, how about creating the following methods:

GetAs(Type type) where T : object
... Other ones similar to Get() or Get(Type)

GetCastedTo(Type type) // Attempts a cast and will not handle the exception if it occurs.
... Other ones similar to Get() or Get(Type)]]></description>
		<content:encoded><![CDATA[<p>I have a [very] small suggestion. How about creating a little more syntactic sugar. Currently your Get(Type) method returns an object, how about creating the following methods:</p>
<p>GetAs(Type type) where T : object<br />
&#8230; Other ones similar to Get() or Get(Type)</p>
<p>GetCastedTo(Type type) // Attempts a cast and will not handle the exception if it occurs.<br />
&#8230; Other ones similar to Get() or Get(Type)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate Kohari</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-91</link>
		<dc:creator><![CDATA[Nate Kohari]]></dc:creator>
		<pubDate>Wed, 24 Sep 2008 10:24:20 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-91</guid>
		<description><![CDATA[@How: You&#039;re right, this post shows the old syntax, which has changed in the latest trunk build (which will become Ninject 1.5).]]></description>
		<content:encoded><![CDATA[<p>@How: You&#8217;re right, this post shows the old syntax, which has changed in the latest trunk build (which will become Ninject 1.5).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How Lun</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-90</link>
		<dc:creator><![CDATA[How Lun]]></dc:creator>
		<pubDate>Wed, 24 Sep 2008 08:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-90</guid>
		<description><![CDATA[There are errors in the code:

No ContextVariable found under Ninject.Core.Parameters.With class:
    With.Parameters.ContextVariable(“controllerName”, controllerName)

I use the below one:
    With.Parameters.Variable(&quot;controllerName&quot;, controllerName)


Same to:
    When.ContextVariable(“controllerName”).EqualTo(“user”)

I use:
    When.Context.Variable(&quot;controllerName&quot;).EqualTo(&quot;user&quot;)

Cheers.]]></description>
		<content:encoded><![CDATA[<p>There are errors in the code:</p>
<p>No ContextVariable found under Ninject.Core.Parameters.With class:<br />
    With.Parameters.ContextVariable(“controllerName”, controllerName)</p>
<p>I use the below one:<br />
    With.Parameters.Variable(&#8220;controllerName&#8221;, controllerName)</p>
<p>Same to:<br />
    When.ContextVariable(“controllerName”).EqualTo(“user”)</p>
<p>I use:<br />
    When.Context.Variable(&#8220;controllerName&#8221;).EqualTo(&#8220;user&#8221;)</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How Lun</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-89</link>
		<dc:creator><![CDATA[How Lun]]></dc:creator>
		<pubDate>Tue, 23 Sep 2008 09:55:05 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-89</guid>
		<description><![CDATA[Perfect, this is what I have been looking for the past 3 days! Thanks.]]></description>
		<content:encoded><![CDATA[<p>Perfect, this is what I have been looking for the past 3 days! Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hanselman's Computer Zen - List of .NET Dependency Injection Containers (IOC)</title>
		<link>http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-87</link>
		<dc:creator><![CDATA[Scott Hanselman's Computer Zen - List of .NET Dependency Injection Containers (IOC)]]></dc:creator>
		<pubDate>Fri, 14 Mar 2008 21:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/2008/03/13/context-variables-in-ninject/#comment-87</guid>
		<description><![CDATA[[...] Context Variables in Ninject [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Context Variables in Ninject [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

