string keys are allowed to be case insensitive. Add in the correct comparer if needed

pull/233/head
Christopher Jolly 2 years ago
parent 4f98215bd0
commit 25e381faa2

@ -4,6 +4,7 @@ using System;
using System.Data; using System.Data;
using System.Data.Common; using System.Data.Common;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.EntityFrameworkCore.Storage.Json;
@ -18,6 +19,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
private readonly bool _keepLineBreakCharacters; private readonly bool _keepLineBreakCharacters;
private readonly int _maxSpecificSize; private readonly int _maxSpecificSize;
private static readonly CaseInsensitiveValueComparer CaseInsensitiveValueComparer = new();
/// <summary> /// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used /// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases. /// directly from your code. This API may change or be removed in future releases.
@ -28,10 +31,11 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
int? size = null, int? size = null,
bool fixedLength = false, bool fixedLength = false,
StoreTypePostfix? storeTypePostfix = null, StoreTypePostfix? storeTypePostfix = null,
bool keepLineBreakCharacters = false) bool keepLineBreakCharacters = false,
bool useKeyComparison = false)
: this( : this(
new RelationalTypeMappingParameters( new RelationalTypeMappingParameters(
new CoreTypeMappingParameters(typeof(string), jsonValueReaderWriter: JsonStringReaderWriter.Instance), new CoreTypeMappingParameters(typeof(string), comparer: useKeyComparison ? CaseInsensitiveValueComparer : null, keyComparer:useKeyComparison ? CaseInsensitiveValueComparer : null, jsonValueReaderWriter: JsonStringReaderWriter.Instance),
storeType ?? GetStoreName(fixedLength), storeType ?? GetStoreName(fixedLength),
storeTypePostfix ?? StoreTypePostfix.Size, storeTypePostfix ?? StoreTypePostfix.Size,
(fixedLength (fixedLength

@ -350,7 +350,8 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
? _fixedLengthUnicodeString.StoreTypeNameBase ? _fixedLengthUnicodeString.StoreTypeNameBase
: _variableLengthUnicodeString.StoreTypeNameBase, : _variableLengthUnicodeString.StoreTypeNameBase,
size: size, size: size,
unicode: true); unicode: true,
useKeyComparison: mappingInfo.IsKeyOrIndex);
} }
if (clrType == typeof(byte[])) if (clrType == typeof(byte[]))

Loading…
Cancel
Save