common-service-locator

When would you use the Common Service Locator?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 07:52:23
I've been looking at the Common Service Locator as a way of abstracting my IoC container but I've been noticing that some people are strongly against this type of this. Do people recommend never using it? Always using it? or sometimes using it? If sometimes, then in what situations would you use it and what situations would you not use it. Ian Ringrose Imagine you are writing library code to be used by 3rd party developers. Your code needs to be able to create service objects that these developers provide. However you don’t know which IoC container each of your callers will be using. The

When would you use the Common Service Locator?

孤者浪人 提交于 2019-11-29 10:37:38
问题 I've been looking at the Common Service Locator as a way of abstracting my IoC container but I've been noticing that some people are strongly against this type of this. Do people recommend never using it? Always using it? or sometimes using it? If sometimes, then in what situations would you use it and what situations would you not use it. 回答1: Imagine you are writing library code to be used by 3rd party developers. Your code needs to be able to create service objects that these developers