Hydra/Hydra.Backend/Database/UlidConverter.cs

11 lines
No EOL
434 B
C#

using System.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Hydra.Backend.Database;
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global",
Justification = "Referenced in HydraContext.ConfigureConventions")]
public class UlidConverter() : ValueConverter<Ulid, Guid>(
convertToProviderExpression: x => x.ToGuid(),
convertFromProviderExpression: x => new Ulid(x)
);