using Yitter.IdGenerator; namespace Easy.Snowflakes; public class DriftingSnowflakeIdGenerator : ISnowflakeIdGenerator { private readonly IIdGenerator Generator; public DriftingSnowflakeIdGenerator(ushort workerId) { Generator = new DefaultIdGenerator(new IdGeneratorOptions() { WorkerId = workerId, BaseTime = DateTime.Parse("2022-01-01 00:00:00") }); } /// /// 生成新的Id /// /// public long Create() { return Generator.NewLong(); } }