参考
.NET中大型项目开发必备(1)--分布式唯一Id - DeveloperSharp - 博客园 (cnblogs.com)
环境搭建
DeveloperSharp
builder.Services.AddTransient();
测试
using DeveloperSharp.Framework.CoreUtility;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace UUID.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class UUID : ControllerBase
{
private readonly IUtility _uuid;
public UUID(IUtility ID)
{
_uuid = ID;
}
[HttpGet]
public string Get()
{
return _uuid.GenerateId("Prefix");
}
}
}