readme updated
cd0f7731d3fc9baf7074142952a119e3cf2807bc
2 files changed
README.mdSessionScopedTest/Controllers/ExampleController.cs
diff --git a/README.md b/README.md
index 048bc7e..3ba1d69 100644
--- a/README.md
+++ b/README.md
@@ -103,21 +103,21 @@ Inject `SessionScopedFactory<ExampleService> factory` into your services or cont
```csharp
public class ExampleController(SessionScopedFactory<ExampleService> factory) : ControllerBase
{
+ private readonly ExampleService exampleService = factory.Instance;
public async Task<IActionResult> Index()
{
HttpContext.Session.SetString("Started", DateTime.Now.ToString());
- var result = await factory.Instance.SetNameAsync($"alphons {Guid.NewGuid()}");
+ var result = await exampleService.SetNameAsync($"alphons {Guid.NewGuid()}");
return Ok("name is set, check url /Example/WhatsYourName");
}
public async Task<IActionResult> WhatsYourName()
{
- var name = await factory.Instance.GetNameAsync();
+ var name = await exampleService.GetNameAsync();
return Ok(name);
}
-
}
```
diff --git a/SessionScopedTest/Controllers/ExampleController.cs b/SessionScopedTest/Controllers/ExampleController.cs
index 9c960f1..6da68fc 100644
--- a/SessionScopedTest/Controllers/ExampleController.cs
+++ b/SessionScopedTest/Controllers/ExampleController.cs
@@ -20,5 +20,4 @@ public class ExampleController(SessionScopedFactory<ExampleService> factory) : C
return Ok(name);
}
-
}