/// <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; } }
/// <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); } }