Skip to content

Dependabot/nuget/src/application/minor and patch 5e1fe4b923#39

Merged
taiphanvan2k3 merged 3 commits intomainfrom
dependabot/nuget/src/Application/minor-and-patch-5e1fe4b923
Nov 11, 2025
Merged

Dependabot/nuget/src/application/minor and patch 5e1fe4b923#39
taiphanvan2k3 merged 3 commits intomainfrom
dependabot/nuget/src/Application/minor-and-patch-5e1fe4b923

Conversation

@taiphanvan2k3
Copy link
Copy Markdown
Member

@taiphanvan2k3 taiphanvan2k3 commented Nov 11, 2025

Summary by CodeRabbit

Release Notes

Chores

  • Optimized Docker configuration with simplified port mapping
  • Added automated Google Cloud deployment scripts for streamlined image management and Artifact Registry integration

dependabot Bot and others added 3 commits November 3, 2025 23:54
Bumps FluentValidation from 12.0.0 to 12.1.0
Bumps MediatR from 12.4.1 to 12.5.0
Bumps Microsoft.EntityFrameworkCore.Design from 8.0.11 to 8.0.21
Bumps Microsoft.Extensions.Caching.StackExchangeRedis from 8.0.0 to 8.0.21
Bumps Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore from 8.0.0 to 8.0.21
Bumps Npgsql.EntityFrameworkCore.PostgreSQL from 8.0.10 to 8.0.11
Bumps Swashbuckle.AspNetCore from 6.6.2 to 6.9.0
Bumps System.IdentityModel.Tokens.Jwt from 8.0.0 to 8.14.0

---
updated-dependencies:
- dependency-name: FluentValidation
  dependency-version: 12.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: MediatR
  dependency-version: 12.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: Microsoft.EntityFrameworkCore.Design
  dependency-version: 8.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Microsoft.Extensions.Caching.StackExchangeRedis
  dependency-version: 8.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore
  dependency-version: 8.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Npgsql.EntityFrameworkCore.PostgreSQL
  dependency-version: 8.0.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Swashbuckle.AspNetCore
  dependency-version: 6.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: System.IdentityModel.Tokens.Jwt
  dependency-version: 8.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@taiphanvan2k3 taiphanvan2k3 self-assigned this Nov 11, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 11, 2025

Walkthrough

This PR refactors the MediatR pipeline to propagate cancellation tokens consistently across behaviors, introduces an explicit Unit of Work pattern with transaction management via IUnitOfWork, and decouples domain events from MediatR by wrapping them in DomainEventNotification. Docker configuration shifts to remote database usage, and GCP deployment automation scripts are added.

Changes

Cohort / File(s) Summary
Deployment Infrastructure
docker-compose.yml
Removes local PostgreSQL service, updates port mapping to 10000:10000, removes inline database connection string, adds ASPNETCORE_URLS environment variable, and includes comment referencing remote database (69.164.244.36:5555).
Deployment Automation
scripts/deploy-gcloud.ps1, scripts/deploy-gcloud.sh
Adds new PowerShell and Bash scripts for automating Docker image deployment to Google Cloud Artifact Registry, including authentication configuration, image tagging, pushing to registry, and suggested Cloud Run deployment commands.
Package Updates
src/Application/Application.csproj, src/Infrastructure/Infrastructure.csproj, src/Web.Api/Web.Api.csproj
Updates MediatR (12.4.1→12.5.0), FluentValidation (12.0.0→12.1.0), Npgsql.EntityFrameworkCore.PostgreSQL (8.0.10→8.0.11), System.IdentityModel.Tokens.Jwt (8.0.0→8.14.0), Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore (8.0.0→8.0.21), Microsoft.Extensions.Caching.StackExchangeRedis (8.0.0→8.0.21), and Swashbuckle.AspNetCore (6.6.2→6.9.0).
Cancellation Token Propagation
src/Application/Common/Behaviors/AuthorizationBehavior.cs, src/Application/Common/Behaviors/CachingBehavior.cs, src/Application/Common/Behaviors/LoggingBehavior.cs, src/Application/Common/Behaviors/PerformanceBehavior.cs, src/Application/Common/Behaviors/ValidationBehavior.cs
All behavior classes updated to pass cancellationToken to next() delegate invocations instead of calling next() without arguments.
Transaction Behavior Refactoring
src/Application/Common/Behaviors/TransactionBehavior.cs
Now depends on IUnitOfWork; implements full transactional flow with BeginTransactionAsync, CommitTransactionAsync, and RollbackTransactionAsync; propagates cancellation token to next delegate.
Domain Event Behavior Enhancement
src/Application/Common/Behaviors/DomainEventBehavior.cs
Propagates cancellation token to next delegate; introduces pre-dispatch persistence logic for non-transactional commands to save changes before domain event dispatch when no active transaction exists.
Domain Event Notification Wrapper
src/Application/Common/DomainEventNotification.cs
Adds new generic DomainEventNotification<TDomainEvent> class implementing INotification to wrap domain events for MediatR distribution.
Domain Event Handler Interface
src/Application/Common/IDomainEventHandler.cs
Updates interface to accept DomainEventNotification<TDomainEvent> instead of raw domain events; removes contravariance modifier from generic parameter.
Unit of Work Interface
src/Application/Common/IUnitOfWork.cs
Adds HasActiveTransaction property and methods BeginTransactionAsync, CommitTransactionAsync, and RollbackTransactionAsync for explicit transaction management.
Event Handler Updates
src/Application/EventHandlers/EmailVerifiedEventHandler.cs, src/Application/EventHandlers/UserCreatedEventHandler.cs
Both handlers updated to accept DomainEventNotification<TEvent> parameter and extract domain event via notification.DomainEvent.
Transactional Command
src/Application/Features/Auth/Register/RegisterCommand.cs
Now implements ITransactionalCommand interface to indicate transaction requirement.
Domain Event Abstraction
src/Domain/Common/IDomainEvent.cs
Removes MediatR dependency by removing INotification base interface; IDomainEvent becomes standalone.
Domain Project Dependencies
src/Domain/Domain.csproj
Removes MediatR package reference.
DataContext Refactoring
src/Infrastructure/Data/Contexts/DataContext.cs
Changed to partial class; implements IUnitOfWork (removes IDataContext); adds _currentTransaction field; removes IDataContext interface from declaration.
UnitOfWork Implementation
src/Infrastructure/Data/Contexts/DataContext.UnitOfWork.cs
New partial file with transaction management implementation: HasActiveTransaction property, GetEntitiesWithDomainEvents(), BeginTransactionAsync(), CommitTransactionAsync(), and RollbackTransactionAsync() methods.
Identity Configuration
src/Infrastructure/Data/Contexts/DataContext.Configuration.cs
New partial file extracting Identity table configuration into ConfigureIdentityTables() method; maps ApplicationUser properties and configures soft-delete query filter.
DataContext Abstraction
src/Infrastructure/Data/Contexts/IDataContext.cs
Entire interface removed; functionality replaced by IUnitOfWork.
DomainEvent Dispatcher
src/Infrastructure/Services/DomainEventDispatcher.cs
Updated to reflectively construct DomainEventNotification<T> and publish the wrapped notification instead of publishing domain events directly.
Repository Update
src/Infrastructure/Repositories/UserRepository.cs
UpdateAsync() no longer awaits SaveChangesAsync; delegates persistence to UnitOfWork.
Service Collection Setup
src/Infrastructure/Extensions/ServiceCollectionExtensions.cs
Changes DI registration from IDataContext to IUnitOfWork.
Pipeline Behavior Ordering
src/Web.Api/Extensions/ApplicationServiceExtensions.cs
Moves TransactionBehavior registration to occur after DomainEventBehavior in the MediatR pipeline.

Sequence Diagram

sequenceDiagram
    participant Client
    participant MediatR
    participant Pipeline as Pipeline Behaviors
    participant UnitOfWork
    participant Handler as Command Handler
    participant Events as Domain Events
    participant Dispatcher
    participant Notification as DomainEventNotification

    Client->>MediatR: Send Command
    MediatR->>Pipeline: Start Pipeline
    
    rect rgba(100, 200, 100, 0.1)
    Note over Pipeline: TransactionBehavior (moved after DomainEventBehavior)
    Pipeline->>UnitOfWork: BeginTransactionAsync()
    end
    
    rect rgba(150, 150, 255, 0.1)
    Note over Pipeline: Other Behaviors<br/>(all pass cancellationToken)
    Pipeline->>Pipeline: Validate, Log, Cache, etc.
    end
    
    rect rgba(200, 100, 100, 0.1)
    Note over Pipeline: DomainEventBehavior
    Pipeline->>UnitOfWork: Check HasActiveTransaction
    alt No Active Transaction
        Pipeline->>UnitOfWork: SaveChangesAsync()
    end
    Pipeline->>Handler: next(cancellationToken)
    end
    
    Handler->>Events: Raise Domain Events
    Handler-->>Pipeline: Return Response
    
    rect rgba(100, 150, 200, 0.1)
    Note over Pipeline: Post-Handler: Event Dispatch
    Pipeline->>Events: Collect Events from Entities
    Pipeline->>Dispatcher: Dispatch Events
    
    loop For Each Domain Event
        Dispatcher->>Notification: Create DomainEventNotification<T>
        Dispatcher->>MediatR: Publish Notification
        MediatR->>Handler: Notify Subscribed Handlers
    end
    end
    
    rect rgba(100, 200, 100, 0.1)
    Note over UnitOfWork: Transaction Completion
    UnitOfWork->>UnitOfWork: SaveChangesAsync()
    UnitOfWork->>UnitOfWork: CommitTransactionAsync()
    end
    
    Pipeline-->>MediatR: Response
    MediatR-->>Client: Result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Transaction logic in TransactionBehavior — Newly implemented transaction management requires careful review of begin/commit/rollback paths and error handling
  • Domain event dispatch refactoring — Changes to DomainEventDispatcher use reflection to construct notifications; verify type safety and correctness
  • DomainEventBehavior pre-persistence logic — New conditional persistence before event dispatch; ensure it doesn't conflict with TransactionBehavior
  • Pipeline behavior reordering — TransactionBehavior moved after DomainEventBehavior; verify correct execution order and transaction scope boundaries
  • IDataContext removal — Verify all dependencies have been migrated to IUnitOfWork; check for any missed references
  • Event handler signature changes — Multiple handlers now unwrap DomainEventNotification; confirm all implementations follow the pattern

Poem

🐰 Tokens now flow through every line,
Where cancellation finds its time,
Domain events in wrappings neat,
UnitOfWork makes tasks complete,
Transactions managed, events dispatch—
A rabbit's code now fits the latch! 🎉


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between dc6ab4c and fc682eb.

📒 Files selected for processing (29)
  • docker-compose.yml (1 hunks)
  • scripts/deploy-gcloud.ps1 (1 hunks)
  • scripts/deploy-gcloud.sh (1 hunks)
  • src/Application/Application.csproj (1 hunks)
  • src/Application/Common/Behaviors/AuthorizationBehavior.cs (2 hunks)
  • src/Application/Common/Behaviors/CachingBehavior.cs (2 hunks)
  • src/Application/Common/Behaviors/DomainEventBehavior.cs (1 hunks)
  • src/Application/Common/Behaviors/LoggingBehavior.cs (1 hunks)
  • src/Application/Common/Behaviors/PerformanceBehavior.cs (1 hunks)
  • src/Application/Common/Behaviors/TransactionBehavior.cs (3 hunks)
  • src/Application/Common/Behaviors/ValidationBehavior.cs (2 hunks)
  • src/Application/Common/DomainEventNotification.cs (1 hunks)
  • src/Application/Common/IDomainEventHandler.cs (1 hunks)
  • src/Application/Common/IUnitOfWork.cs (2 hunks)
  • src/Application/EventHandlers/EmailVerifiedEventHandler.cs (1 hunks)
  • src/Application/EventHandlers/UserCreatedEventHandler.cs (1 hunks)
  • src/Application/Features/Auth/Register/RegisterCommand.cs (1 hunks)
  • src/Domain/Common/IDomainEvent.cs (1 hunks)
  • src/Domain/Domain.csproj (0 hunks)
  • src/Infrastructure/Data/Contexts/DataContext.Configuration.cs (1 hunks)
  • src/Infrastructure/Data/Contexts/DataContext.UnitOfWork.cs (1 hunks)
  • src/Infrastructure/Data/Contexts/DataContext.cs (1 hunks)
  • src/Infrastructure/Data/Contexts/IDataContext.cs (0 hunks)
  • src/Infrastructure/Extensions/ServiceCollectionExtensions.cs (1 hunks)
  • src/Infrastructure/Infrastructure.csproj (2 hunks)
  • src/Infrastructure/Repositories/UserRepository.cs (1 hunks)
  • src/Infrastructure/Services/DomainEventDispatcher.cs (1 hunks)
  • src/Web.Api/Extensions/ApplicationServiceExtensions.cs (1 hunks)
  • src/Web.Api/Web.Api.csproj (1 hunks)
💤 Files with no reviewable changes (2)
  • src/Domain/Domain.csproj
  • src/Infrastructure/Data/Contexts/IDataContext.cs

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@taiphanvan2k3 taiphanvan2k3 merged commit 1ccec05 into main Nov 11, 2025
2 checks passed
@taiphanvan2k3 taiphanvan2k3 deleted the dependabot/nuget/src/Application/minor-and-patch-5e1fe4b923 branch November 11, 2025 16:00
taiphanvan2k3 added a commit that referenced this pull request Dec 22, 2025
* Bump the minor-and-patch group with 8 updates

Bumps FluentValidation from 12.0.0 to 12.1.0
Bumps MediatR from 12.4.1 to 12.5.0
Bumps Microsoft.EntityFrameworkCore.Design from 8.0.11 to 8.0.21
Bumps Microsoft.Extensions.Caching.StackExchangeRedis from 8.0.0 to 8.0.21
Bumps Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore from 8.0.0 to 8.0.21
Bumps Npgsql.EntityFrameworkCore.PostgreSQL from 8.0.10 to 8.0.11
Bumps Swashbuckle.AspNetCore from 6.6.2 to 6.9.0
Bumps System.IdentityModel.Tokens.Jwt from 8.0.0 to 8.14.0

---
updated-dependencies:
- dependency-name: FluentValidation
  dependency-version: 12.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: MediatR
  dependency-version: 12.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: Microsoft.EntityFrameworkCore.Design
  dependency-version: 8.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Microsoft.Extensions.Caching.StackExchangeRedis
  dependency-version: 8.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore
  dependency-version: 8.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Npgsql.EntityFrameworkCore.PostgreSQL
  dependency-version: 8.0.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: Swashbuckle.AspNetCore
  dependency-version: 6.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: System.IdentityModel.Tokens.Jwt
  dependency-version: 8.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: Remove dependecy MediatR at Domain project

* feat: Refactor transaction handling and add deployment scripts for Google Cloud

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant