Description
the mvvm toolkit looks very promising and is straight foreward to apply for a basic app.
Missing though is an example which shows the full potential of this in a scenario with tests.
Specifically where
services are registered temporary
services are registered to a later point not in the start of the programm to allow multiple instances of the services to be used
services are unregistered again also for testing
Steps to Reproduce
I found the following issue which actually helped me to get some of the above working but now I am confused which is the correct way to use mvvm?
when I need to register a service though to a later point I use Ioc.Default.ConfigureServices( new ServiceCollection() .AddSingleton<INavigationService>(new NavigationService(rootFrame)) .BuildServiceProvider());
explained very good in this issue
and when I want to get the singelton instance I call
Ioc.Default.GetRequiredService<INavigationService>().Navigate<SomePage>();
how would I add a mock service for testing
big question now what is the right way to register services and get the instance.
Description the mvvm toolkit looks very promising and is straight foreward to apply for a basic app. Missing though is an example which shows the full potential of this in a scenario with tests. Specifically where
Steps to Reproduce I found the following issue which actually helped me to get some of the above working but now I am confused which is the correct way to use mvvm?
App.Current.Services.GetService<ContactsViewModel>();
Ioc.Default.ConfigureServices( new ServiceCollection() .AddSingleton<INavigationService>(new NavigationService(rootFrame)) .BuildServiceProvider());
explained very good in this issue and when I want to get the singelton instance I callIoc.Default.GetRequiredService<INavigationService>().Navigate<SomePage>();
big question now what is the right way to register services and get the instance.
Enviorement .net 7 ios and android