mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-09-15 14:58:58 -04:00
20 lines
639 B
C#
20 lines
639 B
C#
using Cleanuparr.Domain.Helpers;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
namespace Cleanuparr.Persistence.Converters;
|
|
|
|
/// <summary>
|
|
/// Stores a hash as lowercase text.
|
|
/// Lowercases the query parameters compared against it.
|
|
/// That makes case-sensitive comparisons match whatever casing the caller happens to hold.
|
|
/// Null stays null, so the converter also fits an optional hash column.
|
|
/// </summary>
|
|
public class LowercaseStringConverter : ValueConverter<string?, string?>
|
|
{
|
|
public LowercaseStringConverter() : base(
|
|
v => v == null ? null : DownloadHash.Normalize(v),
|
|
v => v)
|
|
{
|
|
}
|
|
}
|