Skip to content
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