![]() |
VOOZH | about |
dotnet add package SequentialGuid.EntityFrameworkCore --version 6.2.0
NuGet\Install-Package SequentialGuid.EntityFrameworkCore -Version 6.2.0
<PackageReference Include="SequentialGuid.EntityFrameworkCore" Version="6.2.0" />
<PackageVersion Include="SequentialGuid.EntityFrameworkCore" Version="6.2.0" />Directory.Packages.props
<PackageReference Include="SequentialGuid.EntityFrameworkCore" />Project file
paket add SequentialGuid.EntityFrameworkCore --version 6.2.0
#r "nuget: SequentialGuid.EntityFrameworkCore, 6.2.0"
#:package SequentialGuid.EntityFrameworkCore@6.2.0
#addin nuget:?package=SequentialGuid.EntityFrameworkCore&version=6.2.0Install as a Cake Addin
#tool nuget:?package=SequentialGuid.EntityFrameworkCore&version=6.2.0Install as a Cake Tool
EF Core value-converter support for the SequentialGuid library. Register once and Entity Framework Core can automatically persist SequentialGuid and SequentialSqlGuid properties as standard Guid database columns.
dotnet add package SequentialGuid.EntityFrameworkCore
| Target | EF Core Version |
|---|---|
| .NET 10 | 10.0.0 |
| .NET 9 | 9.0.0 |
| .NET 8 | 8.0.10+ |
Register the value converters in your DbContext by overriding ConfigureConventions:
using Microsoft.EntityFrameworkCore;
public class AppDbContext : DbContext
{
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
// Registers converters for both SequentialGuid and SequentialSqlGuid
configurationBuilder.AddSequentialGuidValueConverters();
}
}
This single call registers value converters for both SequentialGuid and SequentialSqlGuid so that any entity property of either type is transparently converted to and from Guid when reading/writing to the database.
using SequentialGuid;
public class Order
{
// Assigned at construction - no database round-trip needed
public SequentialGuid Id { get; set; } = new();
// Timestamp is always available from the ID itself
public DateTime? CreatedAt => Id.Timestamp;
public string Description { get; set; } = string.Empty;
}
If you are targeting SQL Server and want IDs that sort correctly in uniqueidentifier columns, use SequentialSqlGuid instead:
public class Order
{
public SequentialSqlGuid Id { get; set; } = new();
}
Under the hood, SequentialGuidValueConverter<T> (where T : struct, ISequentialGuid<T>) converts:
Guid via value.ValueT.Create(guid), which validates the GUID is a recognized sequential formatThis means the database column type remains a standard Guid / uniqueidentifier - no schema changes are needed.
If your API returns entities containing SequentialGuid / SequentialSqlGuid properties, register the built-in JSON converters in your Program.cs:
using SequentialGuid.Extensions;
builder.Services.AddControllers()
.AddJsonOptions(o => o.JsonSerializerOptions.AddSequentialGuidConverters());
UseSequentialGuidValueGeneration() registers a model-finalizing convention that assigns RFC 9562 v7 sequential value generators to every Guid, SequentialGuid, and SequentialSqlGuid primary-key property. Keys are generated client-side on Add — no database round-trip, retry-safe.
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.AddSequentialGuidValueConverters();
configurationBuilder.UseSequentialGuidValueGeneration(); // v7 keys on Add
// configurationBuilder.UseSequentialGuidValueGeneration(sqlServerByteOrder: true);
}
Guid keys get standard byte order; pass sqlServerByteOrder: true to switch to SQL Server uniqueidentifier-friendly order.SequentialGuid / SequentialSqlGuid keys carry byte order in the type and ignore the flag.HasValueGenerator<T>() always wins — the convention never overwrites it.SequentialGuidValueGenerator, SequentialSqlGuidValueGenerator, SequentialGuidStructValueGenerator, SequentialSqlGuidStructValueGenerator) are public for explicit per-property wiring.See the main SequentialGuid README for full documentation on UUID generation, timestamp extraction, and SQL Server byte-order handling.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.