yes

On 15/05/2012 8:54 AM, npinski wrote:
That's fine.  But i'm not sure I understand...what kind of signature
would the configuration have to have?  I assume you are implying the
type of the generic parameter would need to be passed in to the
factory method?

On May 11, 3:45 pm, Krzysztof Koźmic<[email protected]>
wrote:
You can but since c# doesn't support that your factory method would have
to do some reflection.

@K

On 12/05/2012 4:27 AM, npinski wrote:







Hi there,
Is there a way to register a WindsorContainer to resolve a generic
type using a generic factory method?
I know I can do registration like:
Component.For<IMyService>().ImplementedBy<MyServiceImpl>()
and
Component.For<MyObject>().UsingFactoryMethod(MyObjectFactory.Create)
and even
Component.For(typeof(IMyGenericService<>)).ImplementedBy(typeof(MyGenericSe 
rviceImpl<>))
what I'm looking for is something like:
Component.For(typeof(MyGenericObject<>)).UsingFactoryMethod(MyGenericObject 
Factory.Create<>())
Is there a way to do this in a clean way?  I started peripherally
reading about IGenericImplementationMatchingStrategy, and Typed
Factory Facilities, but this seems like overkill for what I'm doing.
The workaround I have right now is to create a wrapper for
MyGenericObject<>, and have an interface for the wrapper, which I can
then register with the aforementioned syntax
Component.For(typeof(IMyGenericService<>)).ImplementedBy(typeof(MyGenericSe 
rviceImpl<>))
Thanks in advance, guys!

--
You received this message because you are subscribed to the Google Groups "Castle 
Project Development List" 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-devel?hl=en.

Reply via email to