Key Scenarios
This section describes the most common situations in which you might use the SharePoint Service Locator. Each topic in this section describes a realistic scenario, identifies the solution, and provides code to demonstrate how to use the SharePoint Service Locator to complete the task. Each topic also includes usage notes and hints where applicable.
The scenarios are as follows:
- Using a Feature Receiver to Register a Type Mapping. This scenario illustrates how you can use a SharePoint feature receiver class to register a type mapping with the SharePoint Service Locator.
- Testing Classes in Isolation. This scenario illustrates how you can configure the SharePoint Service Locator for use in unit testing, by mapping interfaces to mock objects.
- Providing a Custom Service Locator Implementation in a SharePoint Environment. This scenario illustrates how you can create a factory class to provide an alternative service locator implementation through the SharePoint Service Locator.