IComparable key instead of string

Dec 15, 2008 at 10:49 AM
Hi, guys! Have you thought about service instance key as IComparable object instead of string? 
I think this would be much better and backward compatible with current implementations.
Dec 31, 2008 at 10:10 AM
Edited Dec 31, 2008 at 10:14 AM
Hi edy

We thought of supporting key as object, but we found that it was very common across all containers to support either string based keys, or to use the type. For that reason we decided no to expand the notion as it would not be something all containers would support it. The whole idea of ServiceLocator is that the container uses it in a fashion that is completely independent of specific capabilities the container provides and that each container implementation fully supports  all the capabilities the the interface prescribes. Doing allows you to swap implementations of ISL without impacting the functioning of the app. If for example we opened up the key to support IComparable, then the same app would function differently depending on the container, some containers would know what to do with that IComparable, others would not. This would inhibit the reusability of apps across containers that ISL was designed for.

Does this make sense?

Thanks for your feedback