mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-23 19:30:06 +02:00
Nullable refernce types refactoring
This commit is contained in:
1 parent
e5c90e03d3
commit
e12734981b
85 files changed
+509
-351
No files matched your search
@@ -13,6 +13,6 @@ namespace WotBlitzStatisticsPro.Logic.Pipeline
|
||||
/// </summary>
|
||||
/// <param name="context">Pipeline context</param>
|
||||
/// <param name="next">Next operation</param>
|
||||
Task Invoke(TContext context, Func<TContext, Task> next);
|
||||
Task Invoke(TContext context, Func<TContext, Task>? next);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
/// Builds the pipeline.
|
||||
/// </summary>
|
||||
/// <returns>First operation in pipeline.</returns>
|
||||
IOperation<TContext> Build();
|
||||
IOperation<TContext>? Build();
|
||||
|
||||
/// <summary>
|
||||
/// Adds operation type to the pipeline
|
||||
|
||||
@@ -6,15 +6,15 @@ namespace WotBlitzStatisticsPro.Logic.Pipeline
|
||||
public class OperationMediator<TContext>: IOperation<TContext>
|
||||
{
|
||||
private readonly IOperation<TContext> _current;
|
||||
private readonly IOperation<TContext> _next;
|
||||
private readonly IOperation<TContext>? _next;
|
||||
|
||||
public OperationMediator(IOperation<TContext> current, IOperation<TContext> next)
|
||||
public OperationMediator(IOperation<TContext> current, IOperation<TContext>? next)
|
||||
{
|
||||
_current = current ?? throw new ArgumentNullException(nameof(current));
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public Task Invoke(TContext context, Func<TContext, Task> next)
|
||||
public Task Invoke(TContext context, Func<TContext, Task>? next)
|
||||
{
|
||||
return _current.Invoke(context, c => _next == null ? Task.CompletedTask : _next.Invoke(c, null));
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace WotBlitzStatisticsPro.Logic.Pipeline
|
||||
_operationFactory = operationFactory;
|
||||
}
|
||||
|
||||
public IOperation<TContext> Build()
|
||||
public IOperation<TContext>? Build()
|
||||
{
|
||||
var allOperationTypes = _operations.ToArray();
|
||||
var lastOperationType = allOperationTypes.LastOrDefault();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace WotBlitzStatisticsPro.Logic.Pipeline
|
||||
|
||||
public IOperation<TContext> Create<TContext>(Type operationType)
|
||||
{
|
||||
return _serviceProvider.GetService(operationType) as IOperation<TContext>;
|
||||
return (_serviceProvider.GetService(operationType) as IOperation<TContext>)!;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user