Can you access the names classes are registered under?

Sep 7, 2009 at 1:36 PM

Hi all,

I've registered a number of classes like so:

Container.Register<IService, ClassA>("A");

Container.Register<IService, ClassB>("B");

Container.Register<IService, ClassC>("C");

But I need to present to the user the available IServices by the name they are registered under. So I would like to list A, B, C (or whatever's registered)

Basically, I want a list of all valid strings that can be used in place of NAME here:

Container.Resolve<IService>(NAME);

I need a sort of ResolveAllNames method.

Can anyone help?

Sep 8, 2009 at 7:36 AM

The information is not currently exposed directly. What you can do is create a container extension that watches for the Register events and record which type/name pairs go by. Not ideal, but the best you can do with 1.2. I'll see what we can add to 2.0 to make this more available.