Open Closed

Concurrency handling clarification question #2284


User avatar
0
LW created

Hello, I would very much like this clarified: https://docs.abp.io/en/abp/5.0/Concurrency-Check . Here it says that the concurrency stamp and check is managed by Abp: https://docs.abp.io/en/abp/latest/Entities#basicaggregateroot-class However, I now noticed that, at least in some Abp modules, the concurrency stamp is cycled via UI to update Dtos.

From this https://github.com/abpframework/abp/issues/3351 and from the docs I get the impression that the cycling is not needed but why is it implemented so at least in some modules here for example

My question is that should we always cycle the concurrency stamp through UI or in which cases we should do so.


3 Answer(s)
  • User Avatar
    0
    cotur created

    Hello @LW

    Short answer; Yes, you should always cycle the concurrency stamp through client.

    We always want to be sure that we are updating an entity what we get for updating.

    Here is a gif that shows that an entity can be changed by another client while you are on updating.

    To prevent that, we need to cycle the concurrency stamp. Because we must know which entity state is updating by client?

    If this answer is not properly explains logic, please reply here :)

  • User Avatar
    0
    LW created

    Ok, thanks for your answer. I'm also interested in the longer version of the answer :) In what situations do you see it's ok not to use that method? Suite templates and at least earlier versions of easy CRM do not implement this. Is this a coming change to the templates?

  • User Avatar
    0
    cotur created

    Actually, it depends for your application development.

    All ABP Framework modules have IHasConcurrencyStamp implementation for their update dtos.

    But easyCrm application and suite templates does not.

    For every situation, I always suggest to use IHasConcurrencyStamp for update dtos to prevent future problems, because on low traffic, concurrency problem might not occur but under the high traffic, I believe it will :)

    So, I will suggest to add IHasConcurrencyStamp implementation by default to Suite team. They will discuss and work on it.

    For now, if you want to make sure your app is stone like solid, please implement concurrency to your application :)

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11