😎优化雪花Id相关代码
This commit is contained in:
parent
889f56ade2
commit
6463ccac23
@ -23,7 +23,7 @@ public static class YitIdHelperExtension
|
|||||||
{
|
{
|
||||||
YitIdHelper.SetIdGenerator(options);
|
YitIdHelper.SetIdGenerator(options);
|
||||||
SnowFlakeSingle.WorkId = options.WorkerId;
|
SnowFlakeSingle.WorkId = options.WorkerId;
|
||||||
Console.WriteLine($"###########当前应用WorkId:【{options.WorkerId}】###########");
|
Console.WriteLine($"############ 当前应用雪花WorkId:【{options.WorkerId}】############");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,13 +22,10 @@ public static class SqlSugarSetup
|
|||||||
{
|
{
|
||||||
// 注册雪花Id
|
// 注册雪花Id
|
||||||
var snowIdOpt = App.GetConfig<SnowIdOptions>("SnowId", true);
|
var snowIdOpt = App.GetConfig<SnowIdOptions>("SnowId", true);
|
||||||
|
|
||||||
services.AddYitIdHelper(snowIdOpt);
|
services.AddYitIdHelper(snowIdOpt);
|
||||||
|
|
||||||
StaticConfig.CustomSnowFlakeFunc = () =>
|
// 自定义雪花Id算法
|
||||||
{
|
StaticConfig.CustomSnowFlakeFunc = YitIdHelper.NextId;
|
||||||
return YitIdHelper.NextId();
|
|
||||||
};
|
|
||||||
// 配置字符串表达式
|
// 配置字符串表达式
|
||||||
StaticConfig.DynamicExpressionParserType = typeof(DynamicExpressionParser);
|
StaticConfig.DynamicExpressionParserType = typeof(DynamicExpressionParser);
|
||||||
StaticConfig.DynamicExpressionParsingConfig = new ParsingConfig
|
StaticConfig.DynamicExpressionParsingConfig = new ParsingConfig
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user