SequentialGuid.EntityFrameworkCore 5.0.7

dotnet add package SequentialGuid.EntityFrameworkCore --version 5.0.7
                    
NuGet\Install-Package SequentialGuid.EntityFrameworkCore -Version 5.0.7
                    
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="5.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SequentialGuid.EntityFrameworkCore" Version="5.0.7" />
                    
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 5.0.7
                    
#r "nuget: SequentialGuid.EntityFrameworkCore, 5.0.7"
                    
#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@5.0.7
                    
#: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=5.0.7
                    
Install as a Cake Addin
#tool nuget:?package=SequentialGuid.EntityFrameworkCore&version=5.0.7
                    
Install as a Cake Tool

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

Further Reading

See the main SequentialGuid README for full documentation on UUID generation, timestamp extraction, and SQL Server byte-order handling.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  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
5.0.7 147 3/21/2026
5.0.6 99 3/18/2026
5.0.5 84 3/17/2026
5.0.4 89 3/17/2026