From 17be39baa06d6e65f5b31f6777d38f8e8c6d1680 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Sun, 7 Jan 2024 02:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8CIdGeneratorOptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JD.API/Startup.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/JD.API/Startup.cs b/JD.API/Startup.cs index 9bdcd3e4..e2e13b18 100644 --- a/JD.API/Startup.cs +++ b/JD.API/Startup.cs @@ -12,6 +12,7 @@ using System; using System.IO; using System.Linq; using System.Reflection; +using Yitter.IdGenerator; namespace JD.API { @@ -41,6 +42,9 @@ namespace JD.API var fsql = new FreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.MySql, Configuration.GetConnectionString("DB")).Build(); services.AddSingleton(typeof(IFreeSql), fsql); + var idOption = new IdGeneratorOptions(1); + var idGenerator = new DefaultIdGenerator(idOption); + services.AddSingleton(typeof(IIdGenerator), idGenerator); services.AddCors(options => {