From 9929337e903aae49f34a457e7745aed3254d6f9c Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Fri, 12 Jan 2024 16:20:47 +0000 Subject: [PATCH] Fix comments --- docs/recipes/patterns/add-dependency-injection.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/recipes/patterns/add-dependency-injection.md b/docs/recipes/patterns/add-dependency-injection.md index 5ebc3dd1..b33cf253 100644 --- a/docs/recipes/patterns/add-dependency-injection.md +++ b/docs/recipes/patterns/add-dependency-injection.md @@ -14,21 +14,19 @@ > Instead of functions or modules, DI in .NET and F# only works with classes. -2. Register your type with ASP .NET, typically in the start up / bootstrapper. +2. Register your type with ASP .NET during startup within the `application { }` block. ```diff ++ open Microsoft.Extensions.DependencyInjection application { + //... ++ service_config (fun services -> services.AddSingleton()) - } ``` > [This section](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-8.0#lifetime-and-registration-options) of the official ASP .NET Core article explain the distinction between different lifetime registrations, such as Singleton and Transient. 3. Ensure that your Fable Remoting API can access the `HttpContext` type by using the `fromContext` builder function. ```diff - let webApp = - Remoting.createApi () -- |> Remoting.fromValue createFableRemotingApi ++ |> Remoting.fromContext createFableRemotingApi ```