From 2c01fb5020702dda7896e5baa7bbd9a4384da41c Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Sat, 27 May 2023 17:01:44 +0300 Subject: [PATCH 1/3] docs(DI): Clarify DI docs --- .../HowTo-DependencyInjectionSetup.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md b/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md index e75baf3907..8e09f24e1b 100644 --- a/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md +++ b/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md @@ -60,21 +60,21 @@ Dependency Injection (DI) is an important design pattern for building loosely-co } } ``` -* For the dependency injection framework to handle instantiation of the service as a constructor argument, you must also register your view model with the `IServiceCollection`: +* For the dependency injection framework to handle instantiation of the service as a constructor argument, you must also register your view model with the `IServiceCollection` (or register the view model via routing): ```cs private IHost Host { get; } = BuildAppHost(); private static IHost BuildAppHost() - { - return UnoHost + { + return UnoHost .CreateDefaultBuilder() .ConfigureServices(services => - { - // Register your services - services.AddSingleton(); + { + // Register your services + services.AddSingleton(); // Register view model services.AddTransient(); - }) + }) .Build(); } ``` From ba28387711c53ac5b6f8d8aa7e98897303daafcf Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Sat, 27 May 2023 17:41:30 +0300 Subject: [PATCH 2/3] chore: Update wording --- .../DependencyInjection/HowTo-DependencyInjectionSetup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md b/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md index 8e09f24e1b..4afce48776 100644 --- a/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md +++ b/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md @@ -60,7 +60,7 @@ Dependency Injection (DI) is an important design pattern for building loosely-co } } ``` -* For the dependency injection framework to handle instantiation of the service as a constructor argument, you must also register your view model with the `IServiceCollection` (or register the view model via routing): +* If you are using not using [navigation](../../../Overview/Navigation/NavigationOverview.md), you have to register the view model to `IServiceCollection`, but we recommend using navigation and not manually register the view model as a service: ```cs private IHost Host { get; } = BuildAppHost(); From e0effdd8d0a9c0123e725ed02b875622d52ad6b4 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Sat, 27 May 2023 18:21:35 +0300 Subject: [PATCH 3/3] chore: Use uid instead of relative link --- .../DependencyInjection/HowTo-DependencyInjectionSetup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md b/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md index 4afce48776..7eb5878385 100644 --- a/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md +++ b/doc/Learn/Tutorials/DependencyInjection/HowTo-DependencyInjectionSetup.md @@ -60,7 +60,7 @@ Dependency Injection (DI) is an important design pattern for building loosely-co } } ``` -* If you are using not using [navigation](../../../Overview/Navigation/NavigationOverview.md), you have to register the view model to `IServiceCollection`, but we recommend using navigation and not manually register the view model as a service: +* If you are using not using [navigation](xref:Overview.Navigation), you have to register the view model to `IServiceCollection`, but we recommend using navigation and not manually register the view model as a service: ```cs private IHost Host { get; } = BuildAppHost();