Spring.net - how to choose implementation of interface in runtime ?
        Posted  
        
            by rouen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by rouen
        
        
        
        Published on 2010-03-25T11:00:40Z
        Indexed on 
            2010/03/25
            11:03 UTC
        
        
        Read the original article
        Hit count: 383
        
Hi, in all examples of spring.net IoC i can see something like this:
interface IClass;
class ClassA : IClass;
class ClassB : IClass,
and then in config.xml file something like
[object id="IClass" type="ClassB, Spring.Net.Test" /]
but, i really need to do something like this: in config file there will be more implementations if interface:
[object id="IClass" type="ClassA, Blah" /]
[object id="IClass" type="ClassB, Blah" /]
and then, in runtime i choose from them, something like this:
IClass c = [get me all implementations of IClass, and choose the one with GetType().FullName == myVariableContainingFullTypeNameOfObjectIWant]
how can i do something like this please, i cant google anything for hours.... many thanks !
© Stack Overflow or respective owner