Skip to content

Commit

Permalink
Add ULID generator for EfCore.
Browse files Browse the repository at this point in the history
  • Loading branch information
Codespilot committed Oct 8, 2024
1 parent 7e73335 commit ea0c7be
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.ValueGeneration;

namespace Nerosoft.Euonia.Repository.EfCore;

/// <summary>
/// The ULID (Universally Unique Lexicographically Sortable Identifier) value generator.
/// </summary>
public class UlidValueGenerator : ValueGenerator<string>
{
/// <inheritdoc />
public override string Next(EntityEntry entry)
{
return ObjectId.NewUlid();
}

/// <inheritdoc />
public override bool GeneratesTemporaryValues => false;
}

0 comments on commit ea0c7be

Please sign in to comment.