Unique field for a Custom Entity

  • I need to create an entity which must have an unique name in it's data.

     name: "blabla",

    I can handle it by reading the whole table and check if there is no object with that name and then create the entity, but what can I do with concurrency?
    if someone else calls the create api in the same time and the same name it's not in db yet, then I can't notice it's a duplicate name, then we encounter a duplication.
    any workaround for this situations?

  • bitHeads

    This post is deleted!

  • bitHeads

    Hi Reza, a simple workaround I would recommend is using our atomic methods, such as IncrementGlobalStats, to form the field values with the returned value of that method and some other characters you selected. (defined a global statistic ahead of time, call IncrementGlobalStats() get the returned current value of the global statistic, e.g. 123, then combine with the name you selected to a unique name, such as name_123)