This commit is contained in:
2018-10-08 20:07:38 +00:00
parent d58ede8fd3
commit 7df84c1ce8
9 changed files with 275 additions and 14 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.Threading.Tasks;
namespace AyaNova.Util
{
public class AutoId
{
private readonly object valueLock = new object();
private uint currentValue; //postgre bigint
public AutoId(uint initialValue)
{
currentValue = initialValue;
}
public uint GetNext()
{
lock (valueLock)
{
currentValue += 1;
if (currentValue == 0)
currentValue += 1;
return currentValue;
}
}
}
}