﻿<?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>Maxim Tihobrazov commented on Windsor - IModelInterceptersSelector</title><description>Probably you should look at 
[http://www.qi4j.org/](http://www.qi4j.org/) - java framework for Composite Oriented Programming. They use context as a central part of the design
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment9</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment9</guid><pubDate>Wed, 08 Oct 2008 11:58:09 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor - IModelInterceptersSelector</title><description>Oh, if that is what you want, you would need to use ISubDependencyResolver, which gives you a lot more knowledge about the current resolution
  
  
Note however that if you are creating this customer from the container, it wouldn't need to first resolve its dependencies, and then create it. So you wouldn't have the customer instance until you have the advisors instances
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment8</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment8</guid><pubDate>Sun, 05 Oct 2008 22:43:01 GMT</pubDate></item><item><title>Krzysztof Koźmic commented on Windsor - IModelInterceptersSelector</title><description>Ok, maybe that was not so stupid question after all (or I really need to go to sleep).
  
  
If I use IHandlerSelector I'm only provided with type, key and candidates for handles for _service_ that was asked of me. I don't have, however any information about the object (the customer in my example) the service (ICustomer Advisor) is asked for. So I still don't know the address, (unless I come up with a convention, like having address tuneled into the key).
  
Am I missing something important here?
  
  
I imagined it, as something behaving more like a classic factory, wher e I don't have to register implementations of ICustomerAdvisor. Instead I register the 'factory' and it, based on contextual information (the address in this case) returns configured implementations.
  
  
I suspect a facility might do it, but it feels like using a shotgun to kill a fly.
  
I might also have customers having IAdvisorFactory, that looks like this:
  
public interface IAdvisorFactory
  
{
  
ICustomerAdvisor CreateAdvisor(AbstractCustomer customer);
  
}
  
  
and then call factory.CreateAdvisor(this), but its polluting domain model with infrastructure, and it smells.
  
  
So, what's my best option?
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment7</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment7</guid><pubDate>Sun, 05 Oct 2008 22:37:34 GMT</pubDate></item><item><title>Krzysztof Ko&amp;#197;&amp;#186;mic commented on Windsor - IModelInterceptersSelector</title><description>Reading comprehention. I'll better go to sleep, instead of asking stupid questions ;)
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment6</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment6</guid><pubDate>Sun, 05 Oct 2008 21:48:53 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor - IModelInterceptersSelector</title><description>Krzysztof,
  
IHandlerSelector is the one
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment5</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment5</guid><pubDate>Sun, 05 Oct 2008 21:38:32 GMT</pubDate></item><item><title>Krzysztof Koźmic commented on Windsor - IModelInterceptersSelector</title><description>I like this implementation. Clean and concise.
  
While we're on it, what would be the best way of doing similar thing upon creation.
  
Lets say we have a warehouse and customers. Each customer has ICustomerAdvisor (as a property) that will advise differently based on customers address (different countries, different taxes, and border crossing policies). Never mind the model.
  
What would be the best place to put the logic that would determine which advisor to put into each customer? Since address does not usually change during object' lifetime it would be reasonable to do it sometime during creation (but we already need an address for the customer, to be able to use it to select best advisor).
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment4</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment4</guid><pubDate>Sun, 05 Oct 2008 21:28:56 GMT</pubDate></item><item><title>Ayende Rahien commented on Windsor - IModelInterceptersSelector</title><description>Jim,
  
That particular post was written on a fusion VM windows machine. No idea how you figured out that I am running on the mac
  
  
As for developing on the mac, I am using fusion most of the time, and it just works.
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment3</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment3</guid><pubDate>Sun, 05 Oct 2008 15:46:51 GMT</pubDate></item><item><title>Jim commented on Windsor - IModelInterceptersSelector</title><description>I can tell by the font and font anti-aliasing that you're writing this code on a Mac, what's your set-up like?
  
  
I run VS.NET through Parallels and it's pretty slow and the font anti-aliasing isn't as nice.
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment2</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment2</guid><pubDate>Sun, 05 Oct 2008 15:27:26 GMT</pubDate></item><item><title>j23tom commented on Windsor - IModelInterceptersSelector</title><description>Oren You are an alien !! No human being  can post so fast ! ;)
  
  
PS: You are doing geat job. thanks !
</description><link>http://ayende.com/3634/windsor-imodelinterceptersselector#comment1</link><guid>http://ayende.com/3634/windsor-imodelinterceptersselector#comment1</guid><pubDate>Sun, 05 Oct 2008 15:04:07 GMT</pubDate></item></channel></rss>