feat: add support for validator resolution from dependency injection #1
3 changed files with 14 additions and 0 deletions
commit
21b6f04f8c
|
|
@ -23,6 +23,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
### Changed
|
||||
|
||||
- **request.dispatcher:** Reset type caches when reloading assemblies
|
||||
- **request.validation:** Reset type caches when reloading assemblies
|
||||
|
||||
### Removed
|
||||
|
||||
[1.0.0]: https://code.geekeey.de/geekeey/request/releases/tag/1.0.0
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ internal sealed class RequestDispatcher : IRequestDispatcher
|
|||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public static void ClearCache(Type[]? _)
|
||||
{
|
||||
ScalarRequestHandlers.Clear();
|
||||
StreamRequestHandlers.Clear();
|
||||
}
|
||||
|
||||
public Task<TResponse> DispatchAsync<TResponse>(IScalarRequest<TResponse> request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ internal sealed class DispatchingValidator : IValidator
|
|||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public static void ClearCache(Type[]? _)
|
||||
{
|
||||
ValidatorsHandlers.Clear();
|
||||
}
|
||||
|
||||
public Validation Validate(ValidationContext context)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue