Resolve by Name only

Dec 8, 2009 at 10:48 PM

I have a container, it has a collection of types. Now I need to be able to resovle the type purly by name back to an object. I realize I could have all the types implement an interface but I don;t own the types.

Dec 9, 2009 at 6:23 AM

Sorry we don't currently support that, at least not directly. If you don't know what the type is, how will you do anything with it anyway?

One thing you could do is register a type mapping from object:

container.RegisterType<object, Whatever>("first")

    .RegisterType<object, SomethingElse>("second");

Then you should be able to do:

container.Resolve<object>("first")

and get back the right thing. I think - I've never tried this.