mvvmcross - How to resolve a Collection of Types from within the IoC Container -
We are using MvvmCross in our app, and
In App startup, we register Are all our migration After the registration of the migration, we need to constantly run them, and so the migration operator looks something like this. As you can see, I am clearly using MVX to build each migration. It is tedious and there is a possibility of mistakes, when a bunch of migration ends in the app. What I want to be able to do is hide the entire collection in one, each time I create a new migration, then touch it. Is there any way to do this through MVVMCross? Pseudo Code After I will use LINQ to get a list of type. Unfortunately there is no way to get the list of registered types, so you have to calculate the type of type you need to register for registration. You can also sort by the name of the type. Now if you have a list of types then you can create a new list of instantiated / resolved type to pass it in RunAll () Something like: This is a "browser" code, so there is no guarantee, but you get the essence.
The successor of all migration
It is easy to connect with the type of immigration. Assembly. Surgery type (). Inheritance & lt; IMAGE & gt; () .AsTypes (). Registrar Ezazzi Sysington ();
Mvx.Resolve & lt; IMigrationRunner & gt; (). RunAll (SystemRol.Customer, new list & lt; emigration & gt; {Mvx.IocConstruct & lt; migration 2001 & gt; (), Mvx.IocConstruct & lt; Migration 002 & gt; ()});
Mvx .Resolve & LT; IMigrationRunner & gt; () .RunAll (SystemRole.Client, Mvx.ResolveAll & lt; emigration & gt; ());
migrationTypes = typeof (emigration) on
.Assembly .CreatableTypes (). Inherits & LT; Emigration & gt; () .AsTypes () .OrderBy (T = & gt; t.Name) .Olist (); Mvx.Resolve & LT; IMigrationRunner & gt; () .RunAll (SystemRole.Client, migrationTypes.Select (t => Mvx.Resolve (t) ToList ());
Comments
Post a Comment