You're correct.  BasedOn does not match against interfaces.  We would need to 
add something to the fluent api for this.


On Sep 24, 2010, at 2:49 PM, Johannes Gustafsson wrote:

> Hi,
> 
> I'm trying to register multiple interfaces and using a factory method to 
> instanciate them with DictionaryAdapter:
> 
> The interfaces to be registered looks like this:
> 
>   public interface IHttpSession
>   {
>   }
> 
>   public interface ITestSession : IHttpSession
>   {
>     string StringValue { get; set; }
>     int IntValue { get; set; }
>     int NoValue { get; set; }
>   }
> 
>   public interface ITestSession2 : IHttpSession
>   {
>     string OtherValue { get; set; }
>   }
> 
> I tried the following using the AllTypes descriptor:
> 
>       container
>         .Register(AllTypes
>                     .FromAssemblyInDirectory(assemblyFilter)
>                     .BasedOn<IHttpSession>()
>                     .Configure(component => component.UsingFactoryMethod(
>                       () => new 
> DictionaryAdapterFactory().GetAdapter(component.ServiceType, 
> GetSessionItems())))
>         );
> 
> It does not work however, and looking at the code, specifically 
> BasedOnDescriptor.cs, It looks like it only searches for concrete types.
> 
> Is this supported or am I just doing something wrong? Or is there a better 
> way (I ended up manually enumerating the types and calling 
> Component.For<>()... instead)?
> 
> Regards,
> /Johannes
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/castle-project-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to