diff --git a/Easy.Snowflakes/Easy.Snowflakes.csproj b/Easy.Snowflakes/Easy.Snowflakes.csproj
new file mode 100644
index 0000000..4af1623
--- /dev/null
+++ b/Easy.Snowflakes/Easy.Snowflakes.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ True
+ 1.1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Easy.Snowflakes/Easy/Extensions/ServiceCollectionServiceExtensions.cs b/Easy.Snowflakes/Easy/Extensions/ServiceCollectionServiceExtensions.cs
new file mode 100644
index 0000000..5a01a41
--- /dev/null
+++ b/Easy.Snowflakes/Easy/Extensions/ServiceCollectionServiceExtensions.cs
@@ -0,0 +1,16 @@
+using Easy.Snowflakes;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Easy.Extensions;
+public static class ServiceCollectionServiceExtensions
+{
+ public static IServiceCollection AddDriftingSnowflakes(this IServiceCollection services, ushort workId)
+ {
+ services.AddSingleton(typeof(ISnowflakeIdGenerator), o =>
+ {
+ return new DriftingSnowflakeIdGenerator(workId);
+ });
+
+ return services;
+ }
+}
\ No newline at end of file
diff --git a/Easy.Snowflakes/Easy/Realization/DriftingSnowflakeIdGenerator.cs b/Easy.Snowflakes/Easy/Realization/DriftingSnowflakeIdGenerator.cs
new file mode 100644
index 0000000..f1d509a
--- /dev/null
+++ b/Easy.Snowflakes/Easy/Realization/DriftingSnowflakeIdGenerator.cs
@@ -0,0 +1,24 @@
+using Yitter.IdGenerator;
+
+namespace Easy.Snowflakes;
+public class DriftingSnowflakeIdGenerator : ISnowflakeIdGenerator
+{
+ private readonly IIdGenerator Generator;
+ public DriftingSnowflakeIdGenerator(ushort workerId)
+ {
+ Generator = new DefaultIdGenerator(new IdGeneratorOptions()
+ {
+ WorkerId = workerId,
+ BaseTime = DateTime.Parse("2022-01-01 00:00:00")
+ });
+ }
+
+ ///
+ /// 生成新的Id
+ ///
+ ///
+ public long Create()
+ {
+ return Generator.NewLong();
+ }
+}
\ No newline at end of file
diff --git a/Easy.Snowflakes/Easy/Snowflakes/ISnowflakeIdGenerator.cs b/Easy.Snowflakes/Easy/Snowflakes/ISnowflakeIdGenerator.cs
new file mode 100644
index 0000000..ecdbd3d
--- /dev/null
+++ b/Easy.Snowflakes/Easy/Snowflakes/ISnowflakeIdGenerator.cs
@@ -0,0 +1,5 @@
+namespace Easy.Snowflakes;
+public interface ISnowflakeIdGenerator
+{
+ long Create();
+}
diff --git a/Easy.sln b/Easy.sln
index 43b2468..4783aae 100644
--- a/Easy.sln
+++ b/Easy.sln
@@ -43,6 +43,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthorityManagementCenter",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Easy.DDD.Application", "src\Easy.DDD.Application\Easy.DDD.Application.csproj", "{8D281035-BB53-4377-9386-0CB664A5C6B3}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Easy.Snowflakes", "Easy.Snowflakes\Easy.Snowflakes.csproj", "{9D31086B-1333-4745-AEC2-7966141E503C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -105,6 +107,10 @@ Global
{8D281035-BB53-4377-9386-0CB664A5C6B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D281035-BB53-4377-9386-0CB664A5C6B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D281035-BB53-4377-9386-0CB664A5C6B3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9D31086B-1333-4745-AEC2-7966141E503C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9D31086B-1333-4745-AEC2-7966141E503C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9D31086B-1333-4745-AEC2-7966141E503C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9D31086B-1333-4745-AEC2-7966141E503C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -128,6 +134,7 @@ Global
{3509F9B3-6B41-4E99-B8DE-2A3E3753AFF3} = {3CD21B92-C376-437C-AE85-7D1669AC1A37}
{CEE286C3-D107-497B-8D4A-1F1199A40A10} = {F59B534D-D72A-462B-B8B9-CD3A11B21C49}
{8D281035-BB53-4377-9386-0CB664A5C6B3} = {A263D7E3-0153-48D0-822D-E3E0B51A4890}
+ {9D31086B-1333-4745-AEC2-7966141E503C} = {E2F1B3BA-DD92-4729-BDD0-91BB936520C0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7260112B-0232-4725-AB84-EF4DCCABFD77}
diff --git a/src/Easy.Uow/Easy.UnitOfWork.csproj b/src/Easy.Uow/Easy.UnitOfWork.csproj
index c519647..550010e 100644
--- a/src/Easy.Uow/Easy.UnitOfWork.csproj
+++ b/src/Easy.Uow/Easy.UnitOfWork.csproj
@@ -6,7 +6,7 @@
True
- 1.1.0
+ 1.1.1
diff --git a/src/Easy.Uow/Easy/Extensions/ServiceCollectionServiceExtensions.cs b/src/Easy.Uow/Easy/Extensions/ServiceCollectionServiceExtensions.cs
index 03a6f87..6dd700a 100644
--- a/src/Easy.Uow/Easy/Extensions/ServiceCollectionServiceExtensions.cs
+++ b/src/Easy.Uow/Easy/Extensions/ServiceCollectionServiceExtensions.cs
@@ -8,8 +8,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Easy.Extensions;
public static class ServiceCollectionServiceExtensions
{
- public static IServiceCollection AddUnitOfWork(this IServiceCollection services, Type unitOfWork)
- where TDbContext : DbContext
+ public static IServiceCollection AddUnitOfWork(this IServiceCollection services, Type unitOfWork)
{
services.AddScoped(typeof(IUnitOfWork), unitOfWork);
services.Configure(options =>