mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 06:11:10 +00:00
Migrates persisted identifiers to GUID version 7.
This commit is contained in:
1 parent
fb92a38a7b
commit
8eba545b2b
80 files changed
+305
-129
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.ValueGeneration;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.Common.ValueGeneration;
|
||||
|
||||
/// <summary>
|
||||
/// Generates time ordered version 7 GUIDs for identifier properties whose values are assigned by the persistence layer.
|
||||
/// </summary>
|
||||
public sealed class GuidV7ValueGenerator : ValueGenerator<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the generated values are temporary.
|
||||
/// </summary>
|
||||
/// <remarks>The generated identifiers are stored permanently, so they are not temporary values.</remarks>
|
||||
public override bool GeneratesTemporaryValues => false;
|
||||
|
||||
/// <summary>
|
||||
/// Generates the next time ordered identifier.
|
||||
/// </summary>
|
||||
/// <param name="entry">The tracked entity entry that owns the property.</param>
|
||||
/// <returns>A new version 7 GUID.</returns>
|
||||
public override Guid Next(EntityEntry entry)
|
||||
{
|
||||
return Guid.CreateVersion7();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user