<?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"
	>
<channel>
	<title>Comments on: Playing Nice With Service Locators</title>
	<atom:link href="http://kohari.org/2008/06/18/playing-nice-with-service-locators/feed/" rel="self" type="application/rss+xml" />
	<link>http://kohari.org/2008/06/18/playing-nice-with-service-locators/</link>
	<description>Organized chaos</description>
	<pubDate>Fri, 05 Dec 2008 08:17:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Nate Kohari</title>
		<link>http://kohari.org/2008/06/18/playing-nice-with-service-locators/#comment-337</link>
		<dc:creator>Nate Kohari</dc:creator>
		<pubDate>Sat, 21 Jun 2008 12:36:57 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/?p=89#comment-337</guid>
		<description>Yeah, Autofac is a very cool framework, and Nicholas has a lot of good ideas. I would imagine that Ninject could support something similar, but I haven't looked into it much at this point.</description>
		<content:encoded><![CDATA[<p>Yeah, Autofac is a very cool framework, and Nicholas has a lot of good ideas. I would imagine that Ninject could support something similar, but I haven&#8217;t looked into it much at this point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredrik Kalseth</title>
		<link>http://kohari.org/2008/06/18/playing-nice-with-service-locators/#comment-336</link>
		<dc:creator>Fredrik Kalseth</dc:creator>
		<pubDate>Sat, 21 Jun 2008 08:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/?p=89#comment-336</guid>
		<description>Hmm, your blog stripped the angle brackets from my comment above; the RegisterGeneratedFactory method should take a generic parameter of type EventWatcherFactory for the code I posted to make any sense :)</description>
		<content:encoded><![CDATA[<p>Hmm, your blog stripped the angle brackets from my comment above; the RegisterGeneratedFactory method should take a generic parameter of type EventWatcherFactory for the code I posted to make any sense :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredrik Kalseth</title>
		<link>http://kohari.org/2008/06/18/playing-nice-with-service-locators/#comment-335</link>
		<dc:creator>Fredrik Kalseth</dc:creator>
		<pubDate>Sat, 21 Jun 2008 08:49:48 +0000</pubDate>
		<guid isPermaLink="false">http://kohari.org/?p=89#comment-335</guid>
		<description>Have you looked at Autofac? It has a pretty neat feature called 'delegate factories' (http://code.google.com/p/autofac/wiki/DelegateFactories) which can be used to solve this problem. Using your example, you could create a delegate like

public delegate EventWatcher EventWatcherFactory(string eventName, Action callback)

and register that with the Autofac container

containerBuilder.RegisterGeneratedFactory(new TypedService(typeof(EventWatcher)));

This would then allow anyone who needs to create EventWatchers to request the injection of the EventWatcherFactory, and use it to create event watchers. This has the added bonus of being typesafe and refactor friendly.

I would love to see Ninject offer something similar :)</description>
		<content:encoded><![CDATA[<p>Have you looked at Autofac? It has a pretty neat feature called &#8216;delegate factories&#8217; (http://code.google.com/p/autofac/wiki/DelegateFactories) which can be used to solve this problem. Using your example, you could create a delegate like</p>
<p>public delegate EventWatcher EventWatcherFactory(string eventName, Action callback)</p>
<p>and register that with the Autofac container</p>
<p>containerBuilder.RegisterGeneratedFactory(new TypedService(typeof(EventWatcher)));</p>
<p>This would then allow anyone who needs to create EventWatchers to request the injection of the EventWatcherFactory, and use it to create event watchers. This has the added bonus of being typesafe and refactor friendly.</p>
<p>I would love to see Ninject offer something similar :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
