OnceMi.AspNetCore.IdGenerator
1.0.4
See the version list below for details.
dotnet add package OnceMi.AspNetCore.IdGenerator --version 1.0.4
NuGet\Install-Package OnceMi.AspNetCore.IdGenerator -Version 1.0.4
<PackageReference Include="OnceMi.AspNetCore.IdGenerator" Version="1.0.4" />
paket add OnceMi.AspNetCore.IdGenerator --version 1.0.4
#r "nuget: OnceMi.AspNetCore.IdGenerator, 1.0.4"
// Install OnceMi.AspNetCore.IdGenerator as a Cake Addin #addin nuget:?package=OnceMi.AspNetCore.IdGenerator&version=1.0.4 // Install OnceMi.AspNetCore.IdGenerator as a Cake Tool #tool nuget:?package=OnceMi.AspNetCore.IdGenerator&version=1.0.4
OnceMi.AspNetCore.IdGenerator
ASP.NET Core雪花算法分布式ID生成工具。Use https://github.com/yitter/IdGenerator
How to use
1、Install OnceMi.AspNetCore.IdGenerator。
CLI中安装:
dotnet add package OnceMi.AspNetCore.IdGenerator
Nuget中安装:
在Nuget包管理器中搜索OnceMi.AspNetCore.IdGenerator
并安装。
2、Configuration
You need to configure IdGenerator in your Startup.cs:
services.AddIdGenerator(x =>
{
x.AppId = 1; //Between 1-1023
});
在使用过程中保证每个IdGenerator一个AppId,Appid范围为1-1023。
3、Use
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IIdGeneratorService _idGenerator;
public HomeController(ILogger<HomeController> logger, IIdGeneratorService idGenerator)
{
_logger = logger;
_idGenerator = idGenerator;
}
public IActionResult Index()
{
List<long> ids = new List<long>();
for (int i = 0; i < 5; i++)
{
ids.Add(_idGenerator.NewId());
}
ViewBag.Ids = ids;
return View();
}
}
API Reference
NewId
long NewId();
生成一个ID。
NewIds
List<long> NewIds(int count);
生成指定个数的ID。
Features
Please visit https://github.com/yitter/IdGenerator
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OnceMi.AspNetCore.IdGenerator:
Package | Downloads |
---|---|
FBW.DotNet.AspNetCore
Package Description |
|
BigHammer.Core.IdGenerator
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OnceMi.AspNetCore.IdGenerator:
Repository | Stars |
---|---|
oncemi/OnceMi.Framework
基于.NET 7和Vue 2开发的企业级前后端分离权限管理开发框架(后台管理系统),具有组织管理、角色管理、用户管理、菜单管理、授权管理、计划任务、文件管理等功能。支持国内外多种流行数据库,支持IdentityServer4认证中心。
|