Skip to content

Commit fcc0d17

Browse files
authored
automatic concurrency check if entity and updateDto are IHasConcurrencyStamp
1 parent fa1e7d5 commit fcc0d17

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ public virtual async Task<TGetOutputDto> UpdateAsync(TKey id, TUpdateInput input
9999
await CheckUpdatePolicyAsync();
100100

101101
var entity = await GetEntityByIdAsync(id);
102+
if(entity is IHasConcurrencyStamp && input is IHasConcurrencyStamp){
103+
entity.ConcurrencyStamp = input.ConcurrencyStamp;
104+
}
102105
//TODO: Check if input has id different than given id and normalize if it's default value, throw ex otherwise
103106
await MapToEntityAsync(input, entity);
104107
await Repository.UpdateAsync(entity, autoSave: true);

0 commit comments

Comments
 (0)