增加对数据库主键为numberic的支持
This commit is contained in:
yubaolee
2021-03-13 16:21:56 +08:00
parent f7088c9d29
commit 9c2d044d12
38 changed files with 911 additions and 151 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Yitter.IdGenerator;
namespace Infrastructure.Test
{
class TestSnowflake
{
[Test]
public void Generate()
{
// 全局初始化设置WorkerId默认最大2^16-1。初始化过程全局只需一次且必须最先设置
var options = new IdGeneratorOptions(){ WorkerId = 1};
IIdGenerator IdHelper = new YitIdGenerator(options);
// 初始化以后就可以在需要的地方调用方法生成ID。
long val =IdHelper.NewLong();
int val2 = (int)val;
Console.WriteLine($"val:{val}/int:{val2}");
}
}
}