File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
src/Infrastructure/Data/Interceptors Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -39,16 +39,16 @@ public void UpdateEntities(DbContext? context)
39
39
40
40
foreach ( var entry in context . ChangeTracker . Entries < BaseAuditableEntity > ( ) )
41
41
{
42
- if ( entry . State == EntityState . Added )
43
- {
44
- entry . Entity . CreatedBy = _user . Id ;
45
- entry . Entity . Created = _dateTime . GetUtcNow ( ) ;
46
- }
47
-
48
42
if ( entry . State == EntityState . Added || entry . State == EntityState . Modified || entry . HasChangedOwnedEntities ( ) )
49
43
{
44
+ var utcNow = _dateTime . GetUtcNow ( ) ;
45
+ if ( entry . State == EntityState . Added )
46
+ {
47
+ entry . Entity . CreatedBy = _user . Id ;
48
+ entry . Entity . Created = utcNow ;
49
+ }
50
50
entry . Entity . LastModifiedBy = _user . Id ;
51
- entry . Entity . LastModified = _dateTime . GetUtcNow ( ) ;
51
+ entry . Entity . LastModified = utcNow ;
52
52
}
53
53
}
54
54
}
You can’t perform that action at this time.
0 commit comments