clrcommon-service-locator

What's the difference between GetService and GetInstance in CSL


I'm coding against Common Service Locator and I'm having trouble figuring out the semantic differences between GetInstance, GetAllInstances, and GetService (GetAllInstances is pretty obvious, but both GetInstance and GetService seem to return an object).

For example, what are the MEF equivalents of these three methods?


Solution

  • There is no semantic difference between:

    All of them call GetInstance(serviceType, null) internally.

    Also the reference doesn't even mention the GetService method. http://commonservicelocator.codeplex.com/wikipage?title=API%20Reference&referringTitle=Home

    You can always check the source code: http://commonservicelocator.codeplex.com/SourceControl/changeset/view/27688#332684