← All recipes
Moderne licensed

Use Guid.CreateVersion7()

Recipe IDOpenRewrite.Recipes.CSharp.Migration.Dotnet.Net9.UseGuidCreateVersion7ArtifactOpenRewrite.Recipes.CSharp.Migration.Dotnet

Replace Guid.NewGuid() with Guid.CreateVersion7(). Version 7 GUIDs are time-ordered and better for database primary keys, indexing, and sorting. Available since .NET 9.

Single recipemodernizationcsharpdotnetProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net9.UseGuidCreateVersion7

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet