<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Emad Ibrahim - Latest Comments in Property Injection in ASP.NET MVC with Ninject</title><link>http://emadibrahim.disqus.com/</link><description></description><language>en</language><lastBuildDate>Sat, 06 Sep 2008 10:40:28 -0000</lastBuildDate><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-2182998</link><description>Another valid point, but if I don't refactor the DI stuff then I will end up&lt;br&gt;with a lot of repetition in my unit tests and test fixtures.  I might have&lt;br&gt;to post an example of how I am doing this, to get feedback from the&lt;br&gt;community.  I might be experiencing tunnel vision, since I am the only one&lt;br&gt;writing, reviewing and refactoring the code...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Sat, 06 Sep 2008 10:40:28 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-2182683</link><description>I was doing it via the website. But this time I'm doing it via email.&lt;br&gt;&lt;br&gt;My only concern about doing DI on your tests is that now your tests have&lt;br&gt;dependencies that you can't see while reading the test.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sat, 06 Sep 2008 09:57:18 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-2182622</link><description>I don't have to use DI in my tests but I do because it is easier...  I have&lt;br&gt;one method that just sets up my DI and all it is really doing is mocking all&lt;br&gt;the interfaces...&lt;br&gt;I don't know how deep the threads go...  But we can find out :)...  Are you&lt;br&gt;posting your comments on the site or are you just replying to the emails?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Sat, 06 Sep 2008 09:48:09 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-2182580</link><description>Hmmm, I'm not sure why you would _have_ to use DI in your tests rather than creating your controllers and manually injecting your dependencies (which will likely be mocks or stubs).&lt;br&gt;&lt;br&gt;Btw, how deep can these threads go? =)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sat, 06 Sep 2008 09:42:54 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-2182537</link><description>I see your point...  I am actually using DI in my tests, which I would have&lt;br&gt;to do anyway to inject constructor arguments.  Actually my DI code in my&lt;br&gt;test project didn't change when I moved from constructor to property to&lt;br&gt;kernel.get...&lt;br&gt;At points, I feel like kernel.get is a good solution and at other points I&lt;br&gt;feel it's not.  I can't explain it :)...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Sat, 06 Sep 2008 09:34:08 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-2181901</link><description>Regarding my opposition to Kernel.Get:&lt;br&gt;&lt;br&gt;From the testing angle I'd rather be able to pass my dependencies in via the constructor (or set via a property) than have to mock an instance of IKernel up.&lt;br&gt;&lt;br&gt;Think about how you're going to write tests for the controllers that use that property. With the code listed above you would have to either (a) mock the Kernel or (b) actually wire up DI for your tests.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Sat, 06 Sep 2008 07:35:16 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-1987321</link><description>Is there not a Generic version of Kernel.Get? e.g. &lt;br&gt;var Provider = Kernel.Get&amp;lt;MembershipProvider&amp;gt;();</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Duncan Smart</dc:creator><pubDate>Mon, 01 Sep 2008 15:42:42 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-1986146</link><description>The SecuredController solution wouldn't work for me.  Almost every controller needs to call the property CurrentUser which means every controller will inherit from SecuredController which defeats the point.&lt;br&gt;&lt;br&gt;Why are you opposed to Kernel.Get?  It seems like I can easily achieve the goal I want without having to force every derived controller from calling the base controller consturctor with interfaces...&lt;br&gt;&lt;br&gt;I am trying to get away from doing this&lt;br&gt;&lt;br&gt;class DerviedClass : BaseClass&lt;br&gt;&lt;br&gt;     public DerivedClass(IService1, IService2) : base(IBaseService1, IBaseService2)&lt;br&gt;&lt;br&gt;By using Kernel.Get in the base class then I eliminate the use of base(IBaseService1, IBaseService2) in the derived classes constructor...  I hope that makes sense.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Mon, 01 Sep 2008 15:22:33 -0000</pubDate></item><item><title>Re: Property Injection in ASP.NET MVC with Ninject</title><link>http://www.emadibrahim.com/2008/08/29/property-injection-in-aspnet-mvc-with-ninject/#comment-1921898</link><description>For me the Kernel.Get's should be used as infrequently as possible. You say that you have a BaseController class, but only certain controllers will make use of the MembershipProvider property. Why not create a "SecuredController" that inherits from BaseController and adds the property? This way you're back to doing the injection at the IoC level and only doing it for the controllers that need it.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TroyGoode</dc:creator><pubDate>Fri, 29 Aug 2008 20:41:50 -0000</pubDate></item></channel></rss>