Howto set my IServiceLocator implementation as ServiceLocator.Current?

Posted by stiank81 on Stack Overflow See other posts from Stack Overflow or by stiank81
Published on 2010-04-12T12:02:21Z Indexed on 2010/04/12 12:33 UTC
Read the original article Hit count: 498

I'm working on replacing Unity with Ninject in the Prism framework. This requires me to implement a Ninject specific IServiceLocator. From what I've understood I can inherit the ServiceLocatorImplBase instead, so that's what I do. Now how can I set this to be the Current ServiceLocator? I need this in order to have e.g. the RegionManager get it when it creates regions, and calls:

IServiceLocator locator = ServiceLocator.Current;

This is a static property, but it doesn't have a setter.. There is a function:

void ServiceLocator.SetLocatorProvider(ServiceLocatorProvider newProvider);

..but the argument doesn't match my ServiceLocatorImplBase. Any ideas?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about iservicelocator