MEF 2.0 - mini series: part 6 (Composition scoping and lifetime manage

added by bnaya
1/16/2013 9:09:03 AM


in this post I will cover a new concept of scoping and part lifetime management, which is a great improvement over MEF 1. MEF 1 was coming with a fairly naïve lifetime management. part's lifetime could be either shared or non-shared (you could also apply 'any' but eventually 'any' will be created as shared or non-shared). shared is a singleton instantiation, while non-shared will create a new instance each time. MEF 1's instantiation model doesn't support a complex scenario where some dependency's lifetime should be dictate by the lifetime of other unites. you can conceder a UI window that is having plug-ins that should be dispose while the UI window is closing.