﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>@Simone,
  
This is optional, but I like the syntax. Nate's second suggestion is possible today.
  
About other IoC, no idea, frankly.
  
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment14</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment14</guid><pubDate>Mon, 11 Jun 2007 18:31:18 GMT</pubDate></item><item><title>Simone Busoli commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>As other observed I think that transparently providing this behavior might be misleading. I'd opt for a more explicit syntax like the one suggested by Nate.
  
BTW, do you know how other IoC containers deal with this?
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment13</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment13</guid><pubDate>Mon, 11 Jun 2007 16:41:47 GMT</pubDate></item><item><title>Eric Nicholson commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>I've actually run into this exact problem in the past.  The work around I used was to make the constructor for each of the components in the chain take a simple Object, rather than the Interface type, and then do a cast.
  
  
This solution looks great!  I would prefer something a little more explicit though in case you needed to select a specific service implementation later.  Maybe the &lt;chain&gt; syntax mentioned earlier.  Or even, just use the first XML.   In my experience Windsor would through a cycle dependency exception in that situation as well.
  
  
Great stuff!
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment12</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment12</guid><pubDate>Mon, 11 Jun 2007 13:08:28 GMT</pubDate></item><item><title>Bill Poole commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>Great work!  This is exactly what I was looking for!
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment11</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment11</guid><pubDate>Mon, 11 Jun 2007 12:18:46 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>@Nate,
  
If you got to this point, you really should split the configuration to separate files, and you can always override the default behavior
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment10</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment10</guid><pubDate>Mon, 11 Jun 2007 12:09:03 GMT</pubDate></item><item><title>Nate Kohari commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>I would agree that while this is a pretty clean answer, it seems like there should be more explicit indication that it's a chain -- either:
  
  
&lt;chain&gt;
  
&lt;component .../&gt;
  
&lt;component .../&gt;
  
&lt;/chain&gt;
  
  
Or:
  
  
&lt;component chain="A" .../&gt;
  
&lt;component chain="A" .../&gt;
  
  
Otherwise, if your schema gets very complex, it might be difficult to discern which components are being resolved. For example, if you have:
  
  
&lt;component service="IService" type="ServiceImpl1"/&gt;
  
&lt;component service="IAnotherService" type="FooImpl"/&gt;
  
// ...another 50 component definitions...
  
&lt;component service="IService" type="ServiceImpl2"/&gt;
  
  
Wouldn't the second "chained" request for IService result in SerivceImpl2? This seems like it could be counter-intuitive...
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment9</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment9</guid><pubDate>Mon, 11 Jun 2007 11:41:14 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description> Simone,
  
It would throw, unless you would instruct it to seek a specific one, that is why you have all the &lt;finder&gt;${db_finder}&lt;/finder&gt; elements.
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment8</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment8</guid><pubDate>Mon, 11 Jun 2007 11:01:43 GMT</pubDate></item><item><title>Damien Guard commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>http://www.answers.com/responsibility&amp;r=67
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment7</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment7</guid><pubDate>Mon, 11 Jun 2007 09:36:09 GMT</pubDate></item><item><title>Simone Busoli commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>That's interesting, Ayende. Could you explain a little better what happened with the former approach? You say that a dependency cycle exception was thrown, was it handled by Windsor or what?
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment6</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment6</guid><pubDate>Mon, 11 Jun 2007 09:10:27 GMT</pubDate></item><item><title>Mark Monster commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>Hmm just to add. I like to document my solution. If the code/xml doesn't speak for itself I tend to add comments. What I do in the case of a responsability chain is.
  
  
&lt;!-- Begin ABC chain --&gt;
  
&lt;component.../&gt;
  
&lt;!-- End ABC chain --&gt;
  
  
I'm not sure if there can be found a better way to document the chain with name etc... I was thinking about something like this...
  
&lt;componentChain&gt;
  
&lt;component.../&gt;
  
&lt;/componentChain&gt;
  
  
But now mentioning this, I don't think this solution is desirable.
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment5</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment5</guid><pubDate>Mon, 11 Jun 2007 09:07:10 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>@Mark,
  
XML has _strict_ ordering.
  
I don't follow the rest.
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment4</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment4</guid><pubDate>Mon, 11 Jun 2007 08:46:21 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>Alex,
  
of course :-D
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment3</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment3</guid><pubDate>Mon, 11 Jun 2007 08:45:12 GMT</pubDate></item><item><title>Mark Monster commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>Hmm, sounds nice. But at the end, normally there is no ordering in XML-Elements is there? So the ordering is implicit. I think this will work, but maybe these chains should be grouped in a way that the chains can be found easyly.
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment2</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment2</guid><pubDate>Mon, 11 Jun 2007 07:58:15 GMT</pubDate></item><item><title>Alex Henderson commented on Windsor, Decorators and Chains of Responsabilityes, Oh YEAH!</title><description>Love it, that's so much easier to work with then the previous approach :) is it in the trunk already?
</description><link>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment1</link><guid>http://ayende.com/2540/windsor-decorators-and-chains-of-responsabilityes-oh-yeah#comment1</guid><pubDate>Mon, 11 Jun 2007 07:43:06 GMT</pubDate></item></channel></rss>