Skip to content

CustomExceptionHandler switch more readable and remove duplicate code #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use pattern matching for checking Entity State in AuditableEntityInte…
…rceptor
  • Loading branch information
alirezasariri78 committed Sep 17, 2024
commit 2c0025c339fcd116f13e895987333b116f50ef58
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public void UpdateEntities(DbContext? context)
entry.Entity.CreatedAt = DateTime.UtcNow;
}

if (entry.State == EntityState.Added || entry.State == EntityState.Modified || entry.HasChangedOwnedEntities())
if (entry is { State: EntityState.Added | EntityState.Modified }
|| entry.HasChangedOwnedEntities())
{
entry.Entity.LastModifiedBy = "mehmet";
entry.Entity.LastModified = DateTime.UtcNow;
Expand Down