Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<?xml version="1.0"?>
<ttServiceLoader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ttServiceLoaderRow>
    <Order>1</Order>
    <ServiceTypeName>Test.ServiceCreator.ITypeA,Test.ServiceCreator.ITypeB</ServiceTypeName>
    <ServiceClassName>Test.ServiceCreator.ServiceFactory</ServiceClassName>
  </ttServiceLoaderRow>       
</ttServiceLoader>

Implementing the IServiceCreator

...

Interface

The IServiceCreator implementation must contain a single method CreateInstance which receives the type of service to be created as an input parameter. That way the same instance can serve as a factory for multiple types. Below is a very simple example using a CASE statement. More dynamic implementations are possible.

...