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:

hope helps.

ezequiel

http://blogs.southworks.net


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -