refresh user
This commit is contained in:
parent
4e24796a5d
commit
0d34774059
12 changed files with 141 additions and 32 deletions
16
Femto.Modules.Auth/Application/ScopeBinding.cs
Normal file
16
Femto.Modules.Auth/Application/ScopeBinding.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Femto.Modules.Auth.Application;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// We use this to bind a scope to the request scope in the composition root
|
||||
/// Any scoped services provided by this subcontainer should be accessed via a ScopeBinding injected in the host
|
||||
/// </summary>
|
||||
/// <param name="scope"></param>
|
||||
public class ScopeBinding(IServiceScope scope) : IDisposable
|
||||
{
|
||||
public T GetService<T>() where T : notnull => scope.ServiceProvider.GetRequiredService<T>();
|
||||
|
||||
public void Dispose() => scope.Dispose();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue