VOOZH about

URL: https://www.nuget.org/packages/SequentialGuid.EntityFrameworkCore/

⇱ NuGet Gallery | SequentialGuid.EntityFrameworkCore 6.2.0




SequentialGuid.EntityFrameworkCore 6.2.0

dotnet add package SequentialGuid.EntityFrameworkCore --version 6.2.0
 
 
NuGet\Install-Package SequentialGuid.EntityFrameworkCore -Version 6.2.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SequentialGuid.EntityFrameworkCore" Version="6.2.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SequentialGuid.EntityFrameworkCore" Version="6.2.0" />
 
Directory.Packages.props
<PackageReference Include="SequentialGuid.EntityFrameworkCore" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SequentialGuid.EntityFrameworkCore --version 6.2.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SequentialGuid.EntityFrameworkCore, 6.2.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SequentialGuid.EntityFrameworkCore@6.2.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SequentialGuid.EntityFrameworkCore&version=6.2.0
 
Install as a Cake Addin
#tool nuget:?package=SequentialGuid.EntityFrameworkCore&version=6.2.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SequentialGuid.EntityFrameworkCore

👁 NuGet
👁 NuGet Downloads

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.

Install

dotnet add package SequentialGuid.EntityFrameworkCore

Supported Frameworks

Target EF Core Version
.NET 10 10.0.0
.NET 9 9.0.0
.NET 8 8.0.10+

Setup

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.

Entity Model Example

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();
}

How It Works

Under the hood, SequentialGuidValueConverter<T> (where T : struct, ISequentialGuid<T>) converts:

  • To database: extracts the underlying Guid via value.Value
  • From database: reconstructs the struct via T.Create(guid), which validates the GUID is a recognized sequential format

This means the database column type remains a standard Guid / uniqueidentifier - no schema changes are needed.

JSON Serialization

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());

Value generation

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);
}
  • Plain 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.
  • Explicit HasValueGenerator<T>() always wins — the convention never overwrites it.
  • The four generators (SequentialGuidValueGenerator, SequentialSqlGuidValueGenerator, SequentialGuidStructValueGenerator, SequentialSqlGuidStructValueGenerator) are public for explicit per-property wiring.

Further Reading

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.2.0 216 6/10/2026
6.1.0 662 5/13/2026
6.0.0 218 5/12/2026
5.0.7 1,304 3/21/2026
5.0.6 123 3/18/2026
5.0.5 107 3/17/2026
5.0.4 113 3/17/2026