Instantiating diff class from the same interface via config

Mar 13, 2009 at 9:54 PM
 have one interface with 2 classes implementing it, I need to load each class but unity has:

my config looks like:

      <type name="ClassA" type="IGeneric" mapTo="ClassA">
<type name="ClassB" type="IGeneric" mapTo="ClassB">

any ideas?

Mar 16, 2009 at 3:45 AM
If you want to resolve ClassA, use 
    container.Resolve<IGeneric>("ClassA"); //where "ClassA" is the value of the name attribute.
resolve ClassB,

if you want to resolve both, you can use ResolveAll as provided in the answer posted in the link you provided.

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.