mvvm - Child containers in MvvmCross IoC -


i have wpf mvvm application i'd refactor use mvvmcross support wpf , mono android implementations.

currently using unity 3.0 dependency injection , rely on support container hierarchies (one main container w/ main view , view model , services; , each session server child container views, view models , services have limited lifetime). can ioc in mvvmcross support child containers? if not, how recommend implementing external ioc in manner compatible mvvmcross?

update: don't need support multiple child containers-- single child container active @ 1 time.

thanks!

the mvvmcross framework stands today targeted @ 'mobile' , 'tablet' development. in area there aren't many situations i've encountered far need multiple containers - framework has adopted simple single container approach.

if want/need multiple containers, mvvmcross designed can overridden if want to. if want override ioc library used, should able use pcl ioc container (or inject different native ones). each of these need provide adapter our ioc interface - see imvxiocprovider.cs


in addition this, whilst don't understand current needs (i understand code better text!), other possibilities might suit particular problem area include:

  • you leave current mvvmcross container in place mvvmcross objects, use separate ioc system classes. while out of date, blogpost creating custom custom viewmodellocator helped @gshackles along way using tinyioc , constructor injection - see built in https://github.com/gshackles/crossbar

  • the mvvmcross container allows replace resolvers if need - i.e. if have 1 type registered interface imyservice, registering second type replace first.

  • you register second ioccontainer main mvvmcross container - doing provide child objects via second container. might not perfect constructor injection, should allow closely control child container lifecycle

  • with small changes (inheritance), create multiple copies of current 'simple' mvvmcross container - thing forces object singleton inheritance.

  • with small changes (virtual added interface methods), consider inheriting simplecontainer override functionality , provide multiple resolver dictionaries.

overall, think should have plenty of options this... 1 thing watch out for, though, make sure understand lifecycle of containers on each application platform. wpf lifecycles easy - apps start, apps exit - windowsphone, windowsstore , android apps can launched in different ways (shortcuts, tombstoning, search, etc)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -