From 6f16921a794523cbd49ae2e149f306a4592ea1f4 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 30 Jan 2026 14:41:54 +0100 Subject: [PATCH] Remove Obsolete attributes and update FirstAsync behavior Removed Obsolete attributes from FirstAsync and Exceptions class. Changed FirstAsync return type to non-nullable Task and updated its logic to throw the provided exception when the sequence is empty, instead of returning null. --- .../Common/Extensions/TaskExtensions.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs b/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs index 2fae57ea..163db9ce 100644 --- a/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs +++ b/EnvelopeGenerator.Application/Common/Extensions/TaskExtensions.cs @@ -74,22 +74,19 @@ public static class TaskExtensions /// /// /// - [Obsolete("Implement Mediator behaviors in the Osolete .NET project.")] - public static Task FirstAsync(this Task> task, Func factory) + public static Task FirstAsync(this Task> task, Func factory) where TException : Exception - => task.Then(t => t.FirstOrDefault()) ?? throw factory(); + => task.Then(t => t.FirstOrDefault() ?? throw factory()); } /// /// /// -[Obsolete("Implement Mediator behaviors in the Osolete .NET project.")] public static class Exceptions { /// /// /// - [Obsolete("Implement Mediator behaviors in the Osolete .NET project.")] public static NotFoundException NotFound() => new(); ///