26 lines
584 B
C#
26 lines
584 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
namespace raven_integration
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
} |