Sometimes the container should throw a better exception when you try to
resolve something that isn't in it.
If you try to resolve a type but it isn't registered, but the type
implements an interface or is derived from a type that is registered,
the exception should say so.
Something like:
Exception: interface was not located within container
Details: interface {TInterface} was not located in the container, this
type implements {TService} which is in the container though.
UseCase:
var Container = new WindsorContainer();
Container.Register(Component.For<ISomeInterface>().ImplementedBy<ServiceImplementingSomeInterface>());
Container.Resolve<ServiceImplementingSomeInterface>(); // should throw
new exception (new exception should inherit from the current one as it
is just a special case)
Container.Resolve<string>(); // should throw current exception
Container.Resolve<ISomeInterface>(); // succeeds
point being that I very likely used the wrong type in the call to
Resolve (or constructor param, etc.)
ps. Though the name I am suggesting is a joke, I feel like there is some
merit to the suggestion. Ignore me if I am making no sense or if this is
already done; I am using trunk from about 5 months ago.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---