What is the purpose of the ConcurrencyStamp column in the AspNetUsers table in the new ASP.NET MVC 6 identity?

前端 未结 4 1243
庸人自扰
庸人自扰 2020-12-25 09:18

What is the purpose of the ConcurrencyStamp column in the AspNetUsers table in the new ASP.NET MVC 6 identity?

This is the database schema

4条回答
  •  天涯浪人
    2020-12-25 09:56

    From the source code itself

        /// 
        /// A random value that should change whenever a role is persisted to the store
        /// 
        public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
    

    Basically, see it as it is named. A stamp that is used to identify the current version of the data. If you change it, so does the stamp.

    So if two concurrent updates comes in at the same time, they must have the same stamp or one of them should be discarded.

    Hence the name, ConcurrencyStamp.

提交回复
热议问题