Search code examples
c#.netprismservice-locator

At which point is ServiceLocator created?


I am currently developing an application using the Prism Library 4.5.

I am experiencing the problem with a Model which uses the Microsoft.Practices.ServiceLocator in it's constructor. Which works perfectly fine except when I try to load this specific Model during startup, more precisely in Prisms Bootstrapper. The ServiceLocator is null at this point, so I'm wondering at which point the ServiceLocator is beeing created.


Solution

  • You haven't specified which bootstrapper you are using, but the order for the Unity Bootstrapper is:

    1. CreateLogger
    2. CreateModuleCatalog
    3. ConfigureModuleCatalog
    4. CreateContainer
    5. ConfigureContainer
    6. ConfigureServiceLocator
    7. ConfigureRegionAdapterMappings
    8. ConfigureDefaultRegionBehaviors
    9. RegisterFrameworkExceptionTypes
    10. CreateShell
    11. InitializeShell
    12. InitializeModules