<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: XPO and Instance scopes in autofac</title>
	<link>http://rabdullin.com/xpo-and-instance-scopes-in-autofac/</link>
	<description>Moving towards the efficient development of smart software solutions</description>
	<pubDate>Wed, 20 Aug 2008 14:00:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: Nicholas Blumhardt</title>
		<link>http://rabdullin.com/xpo-and-instance-scopes-in-autofac/#comment-46</link>
		<dc:creator>Nicholas Blumhardt</dc:creator>
		<pubDate>Mon, 21 Jan 2008 11:14:09 +0000</pubDate>
		<guid>http://rabdullin.com/xpo-and-instance-scopes-in-autofac/#comment-46</guid>
		<description>Hi Rinat,

I'm not sure if it is any better or even relevant, but you might want to check out accumulating collections - http://code.google.com/p/autofac/issues/detail?id=2&#38;can=1 - this feature might apply to your task example. Instead of ITaskRegistrar you'd do something like:

builder.RegisterCollection&#60;ITask&#62;()
  .As&#60;IEnumerable&#60;ITask&#62;&#62;()
  .Named("tasks");
builder.Register&#60;ProcessApprovedRegistrations&#62;()
  .MemberOf("tasks");
builder.Register&#60;RetrieveQueuedResults&#62;()
  .MemberOf("tasks");

The advantage might be that you can avoid an 'early' resolve, and I've already done my best to support scope in line with the other container features. You can use MemberOf(typeof(IEnumerable&#60;ITask&#62;)) rather than a name if that is preferable.

This isn't a particularly well-tested feature of the container but one that I think will prove important as it is more easily maintained and extended in applications than a 'ResolveAll&#60;ITask&#62;' kind of feature. Hope this is is useful!

Nick</description>
		<content:encoded><![CDATA[<p>Hi Rinat,</p>
<p>I&#8217;m not sure if it is any better or even relevant, but you might want to check out accumulating collections - <a href="http://code.google.com/p/autofac/issues/detail?id=2&amp;can=1" rel="nofollow">http://code.google.com/p/autofac/issues/detail?id=2&amp;can=1</a> - this feature might apply to your task example. Instead of ITaskRegistrar you&#8217;d do something like:</p>
<p>builder.RegisterCollection&lt;ITask&gt;()<br />
  .As&lt;IEnumerable&lt;ITask&gt;&gt;()<br />
  .Named(&#8221;tasks&#8221;);<br />
builder.Register&lt;ProcessApprovedRegistrations&gt;()<br />
  .MemberOf(&#8221;tasks&#8221;);<br />
builder.Register&lt;RetrieveQueuedResults&gt;()<br />
  .MemberOf(&#8221;tasks&#8221;);</p>
<p>The advantage might be that you can avoid an &#8216;early&#8217; resolve, and I&#8217;ve already done my best to support scope in line with the other container features. You can use MemberOf(typeof(IEnumerable&lt;ITask&gt;)) rather than a name if that is preferable.</p>
<p>This isn&#8217;t a particularly well-tested feature of the container but one that I think will prove important as it is more easily maintained and extended in applications than a &#8216;ResolveAll&lt;ITask&gt;&#8217; kind of feature. Hope this is is useful!</p>
<p>Nick</p>
]]></content:encoded>
	</item>
</channel>
</rss>
