One of the greatest benefits of using a Service Oriented Architecture (SOA) approach to building data-driven applications is that the data services code and the application using the data are completely separate.
This separation allows the Service Provider model to be swapped for a different one. Use the Service Mapping Registry to switch between service provider implementations without having to edit any consumer models. For example, you want to automatically use a stub implementation of a service. This swapping of service providers can be accomplished by any of the following methods.
- Manually changing the Service Provider model reference in the Service Consumer builder call in the application (Service Consumer) model.
- Profiling the Service Provider reference in the Service Consumer builder call in the application model and then applying various values via various profiles to the get correct Service Provider model to be applied.
- Declaring selection and mapping rules for swapping Service Provider models in Service Mapping Registry files.
Using a Service Mapping Registry file has particular advantages over manual or profiled changes to the Service Provider references in the Service Consumer builder call.
- A Service Mapping Registry file can change the Service Provider at run-time and regen-time while the other methods only apply to regen-time.
- Service Mapping Registry files can be configured easily to effect many or even all Service Provider and Service Consumer relationships in a given web application project.
- Service Mapping Registry files can be configured to swap Service Providers based upon simple conditions such as pattern matching with the filenames of the Service Provider models or the value of a mapping parameter declared in the Service Consumer builder call.
There are several key constructs available in a Service Mapping Registry file. These constructs are divided into categories of Selectors and Mappings. Selectors provide the conditions under which Service Providers should be swapped with other Service Providers. The Mappings provide the names of the replacement Service Provider models.
Parent topic: Using data services: wpf7