unity container - PRISM 5, StockTraderRI, NewsController: Injection magic? -
in prism 5 stocktrader example class called newscontroller. usage in application in articlenews.xaml.cs:
public partial class articleview : usercontrol { // note - import here controller created , gets wired article , news reader // view models, shared instances [import] #pragma warning disable 169 private inewscontroller newscontroller; #pragma warning restore 169 ... }
i don't understand when , why instance of newscontroller created.
thx
the prism 5 stocktrader uses mef di container resolve dependencies. in case, newscontroller class decorated export attribute.
[export(typeof(inewscontroller))]
and articleview has inewscontroller field decorated import attribute. view created, mef inject dependency.
you might find following articles useful:
- imports & exports attributes
- stock trader reference implementation using prism library 5.0 wpf
- managing dependencies between components using prism library 5.0 wpf
hope helps.
ezequiel
Comments
Post a Comment