TinyIoC for TinyMvvm

There was an issue created for TinyMvvm regarding to use TinyIoC as the IoC-container. I had created an implementation of IResolver for Autofac. But now I decided to create one for TinyIoC too.

The implementation for it can be installed via the NuGet package, TinyMvvm.TinyIoC, https://www.nuget.org/packages/TinyMvvm.TinyIoC.

The code for setting up the container and the Resolver for the Sample project will look like this if you want to use TinyIoC:

TinyIoCContainer.Current.Register<INavigationHelper>(navigationHelper);

foreach (var type in appAssembly.ExportedTypes.Where(x => x.IsSubclassOf(typeof(ViewModelBase))))
{
    TinyIoCContainer.Current.Register(type);
}

foreach (var type in appAssembly.ExportedTypes.Where(x => x.IsSubclassOf(typeof(Page))))
{
    TinyIoCContainer.Current.Register(type);
}

Resolver.SetResolver(new TinyIoCResolver());

One thought on “TinyIoC for TinyMvvm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.