<?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/"
		>
<channel>
	<title>Comments on: Dependency Injection in ASP.NET MVC: Filters</title>
	<atom:link href="http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Thu, 23 May 2013 23:40:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Gleb Chermennov</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-5724</link>
		<dc:creator>Gleb Chermennov</dc:creator>
		<pubDate>Thu, 04 Apr 2013 20:28:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-5724</guid>
		<description>My bad - I forgot to include my service namespace into a SetUpAllProperties call. Everything works now. Thanks</description>
		<content:encoded><![CDATA[<p>My bad &#8211; I forgot to include my service namespace into a SetUpAllProperties call. Everything works now. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gleb Chermennov</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-5723</link>
		<dc:creator>Gleb Chermennov</dc:creator>
		<pubDate>Thu, 04 Apr 2013 20:18:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-5723</guid>
		<description>Did something change in ASP.NET MVC? Because I can&#039;t make that code work right now - container has the implementation, but after BuildUp call my property is still null</description>
		<content:encoded><![CDATA[<p>Did something change in ASP.NET MVC? Because I can&#8217;t make that code work right now &#8211; container has the implementation, but after BuildUp call my property is still null</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmin Onea</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-4294</link>
		<dc:creator>Cosmin Onea</dc:creator>
		<pubDate>Sat, 04 Feb 2012 10:07:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-4294</guid>
		<description>how do you dispose the action filters? Say one of them depends on database connections or other resources. When are you releasing the resources.</description>
		<content:encoded><![CDATA[<p>how do you dispose the action filters? Say one of them depends on database connections or other resources. When are you releasing the resources.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2387</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Tue, 24 Aug 2010 12:33:21 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2387</guid>
		<description>@PT

No, it&#039;s not wrong.  BuildUp is for property injection, which I see as a bit of a compromise.  It&#039;s more difficult to configure that way (I have to explicitly tell the container what it needs to pay attention to), and I find it to be less explicit.  It&#039;s perfectly acceptable.  I try and avoid it at all costs, when it&#039;s just not possible to get my own ctor in there somewhere.</description>
		<content:encoded><![CDATA[<p>@PT</p>
<p>No, it&#8217;s not wrong.  BuildUp is for property injection, which I see as a bit of a compromise.  It&#8217;s more difficult to configure that way (I have to explicitly tell the container what it needs to pay attention to), and I find it to be less explicit.  It&#8217;s perfectly acceptable.  I try and avoid it at all costs, when it&#8217;s just not possible to get my own ctor in there somewhere.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PT</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2386</link>
		<dc:creator>PT</dc:creator>
		<pubDate>Tue, 24 Aug 2010 02:08:18 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2386</guid>
		<description>Late to the game, but for posterity&#039;s sake, why not call BuildUp() from inside the attribute?

public class CPOPAuthorizeAttribute : AuthorizeAttribute
{
    private ISecurityService securityService; // will be setter injected

    public ISecurityService SecurityService
    {
        get { return securityService; }
        set { securityService = value; }
    }

    protected override bool AuthorizeCore(HttpContextBase httpContext)
    {
        if (httpContext == null)
            throw new ArgumentNullException(&quot;httpContext&quot;);

        if (!httpContext.User.Identity.IsAuthenticated)
            return false; 
        
        ObjectFactory.BuildUp(this); 
        
        return false;

    }

}

Am I doing something glaring wrong (to everyone but me)? :)</description>
		<content:encoded><![CDATA[<p>Late to the game, but for posterity&#8217;s sake, why not call BuildUp() from inside the attribute?</p>
<p>public class CPOPAuthorizeAttribute : AuthorizeAttribute<br />
{<br />
    private ISecurityService securityService; // will be setter injected</p>
<p>    public ISecurityService SecurityService<br />
    {<br />
        get { return securityService; }<br />
        set { securityService = value; }<br />
    }</p>
<p>    protected override bool AuthorizeCore(HttpContextBase httpContext)<br />
    {<br />
        if (httpContext == null)<br />
            throw new ArgumentNullException(&#8220;httpContext&#8221;);</p>
<p>        if (!httpContext.User.Identity.IsAuthenticated)<br />
            return false; </p>
<p>        ObjectFactory.BuildUp(this); </p>
<p>        return false;</p>
<p>    }</p>
<p>}</p>
<p>Am I doing something glaring wrong (to everyone but me)? <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2385</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Wed, 26 May 2010 11:57:18 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2385</guid>
		<description>@Jeff

Good call, thanks for the heads up!</description>
		<content:encoded><![CDATA[<p>@Jeff</p>
<p>Good call, thanks for the heads up!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Barnes</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2384</link>
		<dc:creator>Jeff Barnes</dc:creator>
		<pubDate>Wed, 26 May 2010 05:55:52 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2384</guid>
		<description>Something to keep in mind regarding custom action invokers that recently bit me...

If you intend to use a custom action invoker from an AsyncController, be sure to inherit from AsyncControllerActionInvoker rather than ControllerActionInvoker.  Otherwise, your asychronous methods will get dispatched as standard synchronous methods.  For AsyncController, the AsyncControllerActionInvoker ultimately triggers the method name matching that pairs ActionNameAsync with ActionNameCompleted.  

This wasn&#039;t immediately obvious to me and took some time to trace down the root cause.</description>
		<content:encoded><![CDATA[<p>Something to keep in mind regarding custom action invokers that recently bit me&#8230;</p>
<p>If you intend to use a custom action invoker from an AsyncController, be sure to inherit from AsyncControllerActionInvoker rather than ControllerActionInvoker.  Otherwise, your asychronous methods will get dispatched as standard synchronous methods.  For AsyncController, the AsyncControllerActionInvoker ultimately triggers the method name matching that pairs ActionNameAsync with ActionNameCompleted.  </p>
<p>This wasn&#8217;t immediately obvious to me and took some time to trace down the root cause.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajan</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2383</link>
		<dc:creator>Rajan</dc:creator>
		<pubDate>Fri, 07 May 2010 19:13:18 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2383</guid>
		<description>Thanks, I am using MVC 1.0</description>
		<content:encoded><![CDATA[<p>Thanks, I am using MVC 1.0</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2382</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Fri, 07 May 2010 12:59:42 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2382</guid>
		<description>@Rajan

What version of MVC are you using? This example is for MVC 2.</description>
		<content:encoded><![CDATA[<p>@Rajan</p>
<p>What version of MVC are you using? This example is for MVC 2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajan</title>
		<link>http://lostechies.com/jimmybogard/2010/05/03/dependency-injection-in-asp-net-mvc-filters/#comment-2381</link>
		<dc:creator>Rajan</dc:creator>
		<pubDate>Fri, 07 May 2010 09:13:50 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/03/dependency-injection-in-asp-net-mvc-filters.aspx#comment-2381</guid>
		<description>Hi,
Nice article. I am trying to implement similar to above for Error Logger with HandleErrorAttribute. The new syntax for structure map is the lamda way and for RouteCollection i have implemented like x.ForRequestedType&lt;RouteCollection&gt;().TheDefault.Is.IsThis(RouteTable.Routes); But still i am getting error StructureMap Exception Code:  202
No Default Instance defined for PluginFamily System.Web.Routing.RouteBase. Any idea?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Nice article. I am trying to implement similar to above for Error Logger with HandleErrorAttribute. The new syntax for structure map is the lamda way and for RouteCollection i have implemented like x.ForRequestedType<routecollection>().TheDefault.Is.IsThis(RouteTable.Routes); But still i am getting error StructureMap Exception Code:  202<br />
No Default Instance defined for PluginFamily System.Web.Routing.RouteBase. Any idea?</routecollection></p>
]]></content:encoded>
	</item>
</channel>
</rss>
