SequentialGuid 2.2.1
See the version list below for details.
dotnet add package SequentialGuid --version 2.2.1
NuGet\Install-Package SequentialGuid -Version 2.2.1
<PackageReference Include="SequentialGuid" Version="2.2.1" />
paket add SequentialGuid --version 2.2.1
#r "nuget: SequentialGuid, 2.2.1"
// Install SequentialGuid as a Cake Addin #addin nuget:?package=SequentialGuid&version=2.2.1 // Install SequentialGuid as a Cake Tool #tool nuget:?package=SequentialGuid&version=2.2.1
SequentialGuid
Will generate Sequential Guids based on MongoDB's ObjectId specification. Date & time are encoded into the value so you do not need to store them separately in your database
Define an interface to the signature you like
public interface IIdGenerator
{
Guid NewId();
}
Define your implementing class which can be transient since the singleton is implemented by the framework
public class SequentialIdGenerator : IIdGenerator
{
public Guid NewId() => SequentialGuidGenerator.Instance.NewGuid();
}
Wire it up to .NET Core dependency injection in the ConfigureServices method during application startup
public void ConfigureServices(IServiceCollection services)
{
`services.AddTransient<IIdGenerator, SequentialIdGenerator>();`
}
Finally define a base entity for your application which will contain an id and a timestamp as soon as you initialize it. Note I do not advocate setting a default Id getter this way just illustrating it can be done
public abstract class BaseEntity
{
public Guid Id { get; set; } = SequentialGuidGenerator.Instance.NewGuid();
public DateTime? Timestamp => Id.ToDateTime();
// If you really must have non-UTC time
public DateTime? LocalTime => Id.ToDateTime()?.ToLocalTime();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (13)
Showing the top 5 NuGet packages that depend on SequentialGuid:
Package | Downloads |
---|---|
BR.MicroServices.Utilities
Package Description |
|
SequentialGuid.NodaTime
Provide extension methods to round trip between NodaTime Instant and sequential guid |
|
Loyo.EntityFramework
EntityFrameworkCore UnitOfWork Repositories |
|
Atomiv.Infrastructure.SequentialGuid
Package Description |
|
Optivem.Atomiv.Infrastructure.SequentialGuid
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.0.5 | 21,066 | 3/20/2024 |
4.0.4 | 395,927 | 2/27/2023 |
4.0.3 | 49,060 | 10/25/2022 |
4.0.2 | 8,654 | 10/20/2022 |
4.0.1 | 5,247 | 10/10/2022 |
4.0.0 | 3,345 | 10/5/2022 |
3.0.1 | 94,763 | 2/22/2022 |
3.0.0 | 33,535 | 9/15/2021 |
2.5.0 | 255,152 | 11/18/2020 |
2.4.2 | 21,701 | 7/31/2020 |
2.4.1 | 33,765 | 7/8/2020 |
2.4.0 | 180,296 | 12/13/2017 |
2.2.1 | 2,092 | 10/17/2017 |
2.2.0 | 2,082 | 9/24/2017 |
1.0.0 | 5,261 | 2/17/2014 |
Moved to .netstandard2.0 so it can be used with .NET Core on Linux & OSX