diff --git a/.github/workflows/build.dotnet.yml b/.github/workflows/build.dotnet.yml index 0537ae0bc..a6ed91f97 100644 --- a/.github/workflows/build.dotnet.yml +++ b/.github/workflows/build.dotnet.yml @@ -20,7 +20,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: "5.0.x" + dotnet-version: "6.0.x" - name: Restore NuGet packages run: dotnet restore diff --git a/CQRS.Tests/CQRS.Tests.csproj b/CQRS.Tests/CQRS.Tests.csproj index e62d4d287..1cdaadb1e 100644 --- a/CQRS.Tests/CQRS.Tests.csproj +++ b/CQRS.Tests/CQRS.Tests.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/Core.Api.Testing/Core.Api.Testing.csproj b/Core.Api.Testing/Core.Api.Testing.csproj index 26f97227a..26acce1a3 100644 --- a/Core.Api.Testing/Core.Api.Testing.csproj +++ b/Core.Api.Testing/Core.Api.Testing.csproj @@ -8,12 +8,12 @@ - - - + + + - - + + diff --git a/Core.Api.Testing/ResponseExtensions.cs b/Core.Api.Testing/ResponseExtensions.cs index 59f1bb3a0..e6fe6b04f 100644 --- a/Core.Api.Testing/ResponseExtensions.cs +++ b/Core.Api.Testing/ResponseExtensions.cs @@ -10,8 +10,8 @@ public static async Task GetResultFromJson(this HttpResponseMessage respon { var result = await response.Content.ReadAsStringAsync(); - result.Should().NotBeNull() - .And.Should().NotBe(string.Empty); + result.Should().NotBeNull(); + result.Should().NotBeEmpty(); return result.FromJson(); } diff --git a/Core.ElasticSearch/Core.ElasticSearch.csproj b/Core.ElasticSearch/Core.ElasticSearch.csproj index f276bdfe6..2fd532b9d 100644 --- a/Core.ElasticSearch/Core.ElasticSearch.csproj +++ b/Core.ElasticSearch/Core.ElasticSearch.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/Core.EventStoreDB/Core.EventStoreDB.csproj b/Core.EventStoreDB/Core.EventStoreDB.csproj index 8b4594a31..40f23b9e0 100644 --- a/Core.EventStoreDB/Core.EventStoreDB.csproj +++ b/Core.EventStoreDB/Core.EventStoreDB.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/Core.Marten/Core.Marten.csproj b/Core.Marten/Core.Marten.csproj index 46dd42dd9..afd100858 100644 --- a/Core.Marten/Core.Marten.csproj +++ b/Core.Marten/Core.Marten.csproj @@ -7,11 +7,11 @@ - + - - - + + + diff --git a/Core.Streaming.Kafka/Core.Streaming.Kafka.csproj b/Core.Streaming.Kafka/Core.Streaming.Kafka.csproj index 2e1938ba0..62c9234f6 100644 --- a/Core.Streaming.Kafka/Core.Streaming.Kafka.csproj +++ b/Core.Streaming.Kafka/Core.Streaming.Kafka.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/Core.Streaming/Core.Streaming.csproj b/Core.Streaming/Core.Streaming.csproj index ba4594386..d52297b53 100644 --- a/Core.Streaming/Core.Streaming.csproj +++ b/Core.Streaming/Core.Streaming.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/Core.Testing/Core.Testing.csproj b/Core.Testing/Core.Testing.csproj index 61c30b581..261c45d9c 100644 --- a/Core.Testing/Core.Testing.csproj +++ b/Core.Testing/Core.Testing.csproj @@ -8,13 +8,13 @@ - - - + + + - - + + diff --git a/Core.Tests/Core.Tests.csproj b/Core.Tests/Core.Tests.csproj index 21af0249e..5157ab8b1 100644 --- a/Core.Tests/Core.Tests.csproj +++ b/Core.Tests/Core.Tests.csproj @@ -19,9 +19,9 @@ - - - + + + diff --git a/Core.WebApi/Core.WebApi.csproj b/Core.WebApi/Core.WebApi.csproj index 2315a7469..6acfe005f 100644 --- a/Core.WebApi/Core.WebApi.csproj +++ b/Core.WebApi/Core.WebApi.csproj @@ -7,7 +7,7 @@ - + diff --git a/Core/Core.csproj b/Core/Core.csproj index e1e9e5d2b..e94e9b89e 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj b/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj index 176d5e7ba..c60f3d14a 100644 --- a/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj +++ b/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/Marten.Integration.Tests/Marten.Integration.Tests.csproj b/Marten.Integration.Tests/Marten.Integration.Tests.csproj index 05a671a6c..b31a8328f 100644 --- a/Marten.Integration.Tests/Marten.Integration.Tests.csproj +++ b/Marten.Integration.Tests/Marten.Integration.Tests.csproj @@ -19,10 +19,10 @@ - - - - + + + + diff --git a/MediatR.Tests/MediatR.Tests.csproj b/MediatR.Tests/MediatR.Tests.csproj index bc127e533..b33653581 100644 --- a/MediatR.Tests/MediatR.Tests.csproj +++ b/MediatR.Tests/MediatR.Tests.csproj @@ -18,9 +18,9 @@ - - - + + + diff --git a/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj b/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj index a0d50a6b4..96a3e33fa 100644 --- a/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj +++ b/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj @@ -8,7 +8,7 @@ - + diff --git a/Sample/AsyncProjections/SmartHome.Temperature/SmartHome.Temperature.csproj b/Sample/AsyncProjections/SmartHome.Temperature/SmartHome.Temperature.csproj index cf762f371..3f9060e60 100644 --- a/Sample/AsyncProjections/SmartHome.Temperature/SmartHome.Temperature.csproj +++ b/Sample/AsyncProjections/SmartHome.Temperature/SmartHome.Temperature.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj b/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj index 308186dcb..97274ff7d 100644 --- a/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj +++ b/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj b/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj index 788d147c4..820068c9c 100644 --- a/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj +++ b/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj @@ -8,12 +8,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj b/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj index ef6393a07..81bf284a9 100644 --- a/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj +++ b/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj @@ -10,15 +10,15 @@ - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/ECommerce/Carts/Carts/Carts.csproj b/Sample/ECommerce/Carts/Carts/Carts.csproj index f0b9d83d9..bc2b0b2bd 100644 --- a/Sample/ECommerce/Carts/Carts/Carts.csproj +++ b/Sample/ECommerce/Carts/Carts/Carts.csproj @@ -12,7 +12,7 @@ - + diff --git a/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj b/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj index caf14e1fc..fc1b268bd 100644 --- a/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj +++ b/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj b/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj index 4d8f90788..1f8954515 100644 --- a/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj +++ b/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj @@ -8,12 +8,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj b/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj index 984c78057..ea545cc44 100644 --- a/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj +++ b/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj @@ -10,15 +10,15 @@ - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/ECommerce/Orders/Orders/Orders.csproj b/Sample/ECommerce/Orders/Orders/Orders.csproj index a8f596525..51c24a80f 100644 --- a/Sample/ECommerce/Orders/Orders/Orders.csproj +++ b/Sample/ECommerce/Orders/Orders/Orders.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj b/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj index eb8112a96..e0332e831 100644 --- a/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj +++ b/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj b/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj index 7488b1589..1d7b73a10 100644 --- a/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj +++ b/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj @@ -8,12 +8,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj b/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj index 86dda11f4..6ee8caa50 100644 --- a/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj +++ b/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj @@ -10,15 +10,15 @@ - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/ECommerce/Payments/Payments/Payments.csproj b/Sample/ECommerce/Payments/Payments/Payments.csproj index 5afadd93c..a715a88f4 100644 --- a/Sample/ECommerce/Payments/Payments/Payments.csproj +++ b/Sample/ECommerce/Payments/Payments/Payments.csproj @@ -12,7 +12,7 @@ - + diff --git a/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj b/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj index 9c9226342..0b6a975ee 100644 --- a/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj +++ b/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/ECommerce/Shipments/Shipments.Api/Controllers/ShipmentsController.cs b/Sample/ECommerce/Shipments/Shipments.Api/Controllers/ShipmentsController.cs index 84237c379..a58eeae93 100644 --- a/Sample/ECommerce/Shipments/Shipments.Api/Controllers/ShipmentsController.cs +++ b/Sample/ECommerce/Shipments/Shipments.Api/Controllers/ShipmentsController.cs @@ -17,20 +17,20 @@ public ShipmentsController(IPackageService packageService) } [HttpPost] - public async Task Send([FromBody]SendPackage? request) + public async Task Send([FromBody] SendPackage? request) { if (request == null) throw new ArgumentNullException(nameof(request)); - var package = await packageService.SendPackage(request); + var package = await packageService.SendPackage(request, HttpContext.RequestAborted); - return Created("api/Reservations", package.Id); + return Created("api/Reservations", package.Id); } [HttpGet("{id}")] public Task Get(Guid id) { - return packageService.GetById(id); + return packageService.GetById(id, HttpContext.RequestAborted); } } } diff --git a/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj b/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj index 308714b05..90815de3a 100644 --- a/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj +++ b/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj @@ -8,12 +8,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj b/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj index d7c59d460..a6093cf93 100644 --- a/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj +++ b/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj @@ -10,15 +10,15 @@ - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/ECommerce/Shipments/Shipments/Packages/PackageService.cs b/Sample/ECommerce/Shipments/Shipments/Packages/PackageService.cs index 1f9b78239..809dd9d09 100644 --- a/Sample/ECommerce/Shipments/Shipments/Packages/PackageService.cs +++ b/Sample/ECommerce/Shipments/Shipments/Packages/PackageService.cs @@ -15,7 +15,7 @@ public interface IPackageService { Task SendPackage(SendPackage request, CancellationToken cancellationToken = default); Task DeliverPackage(DeliverPackage request, CancellationToken cancellationToken = default); - Task GetById(Guid id); + Task GetById(Guid id, CancellationToken ct); } internal class PackageService: IPackageService @@ -38,11 +38,17 @@ IProductAvailabilityService productAvailabilityService throw new ArgumentNullException(nameof(productAvailabilityService)); } - public Task GetById(Guid id) + public async Task GetById(Guid id, CancellationToken ct) { - return dbContext.Packages + var package = await dbContext.Packages .Include(p => p.ProductItems) - .SingleOrDefaultAsync(p => p.Id == id); + .SingleOrDefaultAsync(p => p.Id == id, ct); + + + if (package == null) + throw new InvalidOperationException($"Package with id {id} wasn't found"); + + return package; } public async Task SendPackage(SendPackage request, CancellationToken cancellationToken = default) @@ -82,7 +88,7 @@ public async Task SendPackage(SendPackage request, CancellationToken ca public async Task DeliverPackage(DeliverPackage request, CancellationToken cancellationToken = default) { - var package = await Packages.FindAsync(request.Id, cancellationToken); + var package = await GetById(request.Id, cancellationToken); Packages.Update(package); diff --git a/Sample/ECommerce/Shipments/Shipments/Shipments.csproj b/Sample/ECommerce/Shipments/Shipments/Shipments.csproj index dc21a5f4f..663295e1b 100644 --- a/Sample/ECommerce/Shipments/Shipments/Shipments.csproj +++ b/Sample/ECommerce/Shipments/Shipments/Shipments.csproj @@ -16,18 +16,18 @@ - - + + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj index 6d23c5f7b..ad6a9ab95 100644 --- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj +++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj index 87b28b3eb..76c68993f 100644 --- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj +++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj @@ -8,12 +8,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj index 51b4d8f4d..48a754feb 100644 --- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj +++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj @@ -10,15 +10,15 @@ - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts/Carts.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts/Carts.csproj index 6d3e150c2..1c76e0205 100644 --- a/Sample/EventStoreDB/ECommerce/Carts/Carts/Carts.csproj +++ b/Sample/EventStoreDB/ECommerce/Carts/Carts/Carts.csproj @@ -14,7 +14,7 @@ - + diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj index 011b86f75..d11a8ff46 100644 --- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj +++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api/Controllers/ShoppingCartsController.cs b/Sample/EventStoreDB/Simple/ECommerce.Api/Controllers/ShoppingCartsController.cs index 6ad197b7e..b55a17514 100644 --- a/Sample/EventStoreDB/Simple/ECommerce.Api/Controllers/ShoppingCartsController.cs +++ b/Sample/EventStoreDB/Simple/ECommerce.Api/Controllers/ShoppingCartsController.cs @@ -113,12 +113,19 @@ CancellationToken ct } [HttpGet("{id}")] - public Task Get( - [FromServices] Func> query, + public async Task Get( + [FromServices] Func> query, Guid id, CancellationToken ct - ) => - query(GetCartById.From(id), ct); + ) + { + var result = await query(GetCartById.From(id), ct); + + if (result == null) + return NotFound(); + + return Ok(result); + } [HttpGet] public Task> Get( diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj b/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj index 8d8d9b07a..0d619843e 100644 --- a/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj +++ b/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj @@ -8,7 +8,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj b/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj index e33332148..b47dbf585 100644 --- a/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj +++ b/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj @@ -8,19 +8,19 @@ - - - + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/EventStoreDB/Simple/ECommerce.Core/Projections/EntityFrameworkProjection.cs b/Sample/EventStoreDB/Simple/ECommerce.Core/Projections/EntityFrameworkProjection.cs index 0cf6961e0..bacbb2ced 100644 --- a/Sample/EventStoreDB/Simple/ECommerce.Core/Projections/EntityFrameworkProjection.cs +++ b/Sample/EventStoreDB/Simple/ECommerce.Core/Projections/EntityFrameworkProjection.cs @@ -131,6 +131,9 @@ public async Task Handle(TEvent @event, CancellationToken ct) var viewId = getViewId(@event); var view = await dbContext.FindAsync(new [] {viewId}, ct); + if (view == null) + throw new InvalidOperationException($"{typeof(TView).Name} with id {viewId} wasn't found"); + prepare?.Invoke(dbContext.Entry(view), ct); update(@event, view); diff --git a/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj b/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj index 9c83c7698..bd8809149 100644 --- a/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj +++ b/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj @@ -8,19 +8,19 @@ - - - + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Sample/EventStoreDB/Simple/ECommerce/ShoppingCarts/GettingCartById/GetCartById.cs b/Sample/EventStoreDB/Simple/ECommerce/ShoppingCarts/GettingCartById/GetCartById.cs index 605c14223..0acebe3e9 100644 --- a/Sample/EventStoreDB/Simple/ECommerce/ShoppingCarts/GettingCartById/GetCartById.cs +++ b/Sample/EventStoreDB/Simple/ECommerce/ShoppingCarts/GettingCartById/GetCartById.cs @@ -18,16 +18,16 @@ public static GetCartById From(Guid cartId) return new GetCartById(cartId); } - public static Task Handle( + public static async Task Handle( IQueryable shoppingCarts, GetCartById query, CancellationToken ct ) { - return shoppingCarts + return await shoppingCarts .SingleOrDefaultAsync( x => x.Id == query.ShoppingCartId, ct - ); + ) ?? throw new InvalidOperationException(); } } } diff --git a/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj b/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj index 62772dbe2..86503e748 100644 --- a/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj +++ b/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj @@ -7,10 +7,10 @@ - + - + diff --git a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj index 74b19b839..075576796 100644 --- a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj +++ b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj @@ -16,12 +16,12 @@ - - - - - - + + + + + + @@ -29,7 +29,7 @@ all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj b/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj index 99778f06f..77e86eef2 100644 --- a/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj +++ b/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj b/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj index 58eded80f..eb68934d1 100644 --- a/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj +++ b/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj @@ -9,7 +9,7 @@ - + diff --git a/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj b/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj index 7edb563fe..cb0e8bc41 100644 --- a/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj +++ b/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj @@ -16,12 +16,12 @@ - - - - - - + + + + + + @@ -29,7 +29,7 @@ all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/MeetingsManagement/MeetingsSearch/MeetingsSearch.csproj b/Sample/MeetingsManagement/MeetingsSearch/MeetingsSearch.csproj index 448dca6f8..fd86dc61e 100644 --- a/Sample/MeetingsManagement/MeetingsSearch/MeetingsSearch.csproj +++ b/Sample/MeetingsManagement/MeetingsSearch/MeetingsSearch.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj b/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj index 7e85050e8..111640ec0 100644 --- a/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj +++ b/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj @@ -9,15 +9,15 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/Tickets/Tickets.Api/Tickets.Api.csproj b/Sample/Tickets/Tickets.Api/Tickets.Api.csproj index 11f7117f4..b32d5facd 100644 --- a/Sample/Tickets/Tickets.Api/Tickets.Api.csproj +++ b/Sample/Tickets/Tickets.Api/Tickets.Api.csproj @@ -8,7 +8,7 @@ - + diff --git a/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj b/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj index 5bd65c23e..4a8f69a61 100644 --- a/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj +++ b/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj @@ -10,16 +10,16 @@ - - - + + + all runtime; build; native; contentfiles; analyzers - + diff --git a/Sample/Tickets/Tickets/Tickets.csproj b/Sample/Tickets/Tickets/Tickets.csproj index 6b239fcd9..a10a0bf6b 100644 --- a/Sample/Tickets/Tickets/Tickets.csproj +++ b/Sample/Tickets/Tickets/Tickets.csproj @@ -18,7 +18,7 @@ - - + + diff --git a/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj b/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj index eb09ddffc..ef67d48ac 100644 --- a/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj +++ b/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj b/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj index ede97b462..cdab03793 100644 --- a/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj +++ b/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj @@ -7,10 +7,10 @@ - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Sample/Warehouse/Warehouse/Core/Entities/EntitiesExtensions.cs b/Sample/Warehouse/Warehouse/Core/Entities/EntitiesExtensions.cs index 347177772..9e643b0f4 100644 --- a/Sample/Warehouse/Warehouse/Core/Entities/EntitiesExtensions.cs +++ b/Sample/Warehouse/Warehouse/Core/Entities/EntitiesExtensions.cs @@ -13,7 +13,7 @@ public static async ValueTask AddAndSave(this DbContext dbContext, T entity, await dbContext.SaveChangesAsync(ct); } - public static ValueTask Find(this DbContext dbContext, TId id, CancellationToken ct) + public static ValueTask Find(this DbContext dbContext, TId id, CancellationToken ct) where T : class where TId : notnull => dbContext.FindAsync(new object[] {id}, ct); } diff --git a/Sample/Warehouse/Warehouse/Warehouse.csproj b/Sample/Warehouse/Warehouse/Warehouse.csproj index 6392fa876..287aecdc8 100644 --- a/Sample/Warehouse/Warehouse/Warehouse.csproj +++ b/Sample/Warehouse/Warehouse/Warehouse.csproj @@ -20,12 +20,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj b/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj +++ b/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj b/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj +++ b/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj b/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj +++ b/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj b/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj +++ b/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj b/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj +++ b/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj b/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj +++ b/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj b/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj +++ b/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj b/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj +++ b/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj b/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj index d75396e0f..4c942c8f0 100644 --- a/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj +++ b/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj @@ -7,9 +7,9 @@ - - - + + + all diff --git a/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj b/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj +++ b/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj b/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj index cdbed5a75..bf6b4ff4c 100644 --- a/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj +++ b/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj b/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj index e6f0e1d05..bb865506b 100644 --- a/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj +++ b/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj @@ -9,9 +9,9 @@ - + - + diff --git a/Workshops/BuildYourOwnEventStore/EventStoreBasics/EventStoreBasics.csproj b/Workshops/BuildYourOwnEventStore/EventStoreBasics/EventStoreBasics.csproj index 436f1359e..dc69b946e 100644 --- a/Workshops/BuildYourOwnEventStore/EventStoreBasics/EventStoreBasics.csproj +++ b/Workshops/BuildYourOwnEventStore/EventStoreBasics/EventStoreBasics.csproj @@ -7,7 +7,7 @@ - + diff --git a/Workshops/BuildYourOwnEventStore/Tools/Tools.csproj b/Workshops/BuildYourOwnEventStore/Tools/Tools.csproj index 9c48792ae..dbd7a1214 100644 --- a/Workshops/BuildYourOwnEventStore/Tools/Tools.csproj +++ b/Workshops/BuildYourOwnEventStore/Tools/Tools.csproj @@ -8,7 +8,7 @@ - +