Esempio n. 1
0
 /// <summary>
 /// 生成Id
 /// </summary>
 /// <returns></returns>
 public static int GenerateId()
 {
     lock (SyncRoot)
     {
         string userCode = "USER_CODE";
         var userCache = new ShareCacheStruct<UserSet>();
         UserSet userSet = userCache.FindKey(userCode);
         if (userSet == null)
         {
             userSet = new UserSet() { Code = userCode, CurrUserId = 1000 };
             userCache.Add(userSet);
         }
         userSet.CurrUserId++;
         userCache.Update();
         return userSet.CurrUserId;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 生成Id
 /// </summary>
 /// <returns></returns>
 public static int GenerateId()
 {
     lock (SyncRoot)
     {
         string  userCode  = "USER_CODE";
         var     userCache = new ShareCacheStruct <UserSet>();
         UserSet userSet   = userCache.FindKey(userCode);
         if (userSet == null)
         {
             userSet = new UserSet()
             {
                 Code = userCode, CurrUserId = 1000
             };
             userCache.Add(userSet);
         }
         userSet.CurrUserId++;
         userCache.Update();
         return(userSet.CurrUserId);
     }
 }