I'm using Prism with a Windsor bootstrapper (based on the code 
here<https://github.com/bszafko/PrismContrib.WindsorExtensions>). 
One of the virtual methods - ConfigureServiceLocator() - provides a place 
to specify the IoC container that will be used by the MS service locator 
(for things like Prism navigation). With this in place I can use the MS 
service locator like so:-

      var o = ServiceLocator.Current.GetInstance<IFoo>();

I realise this is an anti-pattern - 99% of the time I'm using DI (via 
constructors), but there are a handful of places where I'm having to use a 
service locator.

What I want to know is, if I get an instance of a transient type using the 
MS service locator, am I responsible for releasing it, and if so, how? The 
service locator doesn't provide such a method (I guess I would have to 
inject an instance of the Windsor container into the class where I need to 
do the release).

Also, as Prism navigation is (presumably) using the MS service locator 
under the covers to instantiate views/view models, am I responsible for 
releasing these too? I've not found any "hooks" in Prism navigation that 
would be a suitable place to do such a thing.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to