Skip to content

Commit 6cdf008

Browse files
NH-2319 - AsQueryable Map support adjustments, to be squashed.
1 parent ac0275b commit 6cdf008

File tree

3 files changed

+53
-63
lines changed

3 files changed

+53
-63
lines changed

src/NHibernate.Test/NHSpecificTest/NH1136/PersistentMilestoneCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public PersistentMilestoneCollection(ISessionImplementor session) : base(session
2020
public TValue FindValueFor(TKey key)
2121
{
2222
Read();
23-
return ((IMilestoneCollection<TKey, TValue>) WrappedMap).FindValueFor(key);
23+
return ((IMilestoneCollection<TKey, TValue>) Entries(null)).FindValueFor(key);
2424
}
2525

2626
#endregion
2727
}
28-
}
28+
}

src/NHibernate/Async/Collection/Generic/PersistentGenericMap.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public override Task<ICollection> GetOrphansAsync(object snapshot, string entity
4242
try
4343
{
4444
var sn = (IDictionary<TKey, TValue>) snapshot;
45-
return GetOrphansAsync((ICollection)sn.Values, (ICollection)WrappedMap.Values, entityName, Session, cancellationToken);
45+
return GetOrphansAsync((ICollection)sn.Values, (ICollection)_wrappedMap.Values, entityName, Session, cancellationToken);
4646
}
4747
catch (Exception ex)
4848
{
@@ -55,11 +55,11 @@ public override async Task<bool> EqualsSnapshotAsync(ICollectionPersister persis
5555
cancellationToken.ThrowIfCancellationRequested();
5656
IType elementType = persister.ElementType;
5757
var xmap = (IDictionary<TKey, TValue>)GetSnapshot();
58-
if (xmap.Count != WrappedMap.Count)
58+
if (xmap.Count != _wrappedMap.Count)
5959
{
6060
return false;
6161
}
62-
foreach (KeyValuePair<TKey, TValue> entry in WrappedMap)
62+
foreach (KeyValuePair<TKey, TValue> entry in _wrappedMap)
6363
{
6464
// This method is not currently called if a key has been removed/added, but better be on the safe side.
6565
if (!xmap.TryGetValue(entry.Key, out var value) ||
@@ -96,17 +96,17 @@ public override async Task InitializeFromCacheAsync(ICollectionPersister persist
9696
BeforeInitialize(persister, size);
9797
for (int i = 0; i < size; i += 2)
9898
{
99-
WrappedMap[(TKey)await (persister.IndexType.AssembleAsync(array[i], Session, owner, cancellationToken)).ConfigureAwait(false)] =
99+
_wrappedMap[(TKey)await (persister.IndexType.AssembleAsync(array[i], Session, owner, cancellationToken)).ConfigureAwait(false)] =
100100
(TValue)await (persister.ElementType.AssembleAsync(array[i + 1], Session, owner, cancellationToken)).ConfigureAwait(false);
101101
}
102102
}
103103

104104
public override async Task<object> DisassembleAsync(ICollectionPersister persister, CancellationToken cancellationToken)
105105
{
106106
cancellationToken.ThrowIfCancellationRequested();
107-
object[] result = new object[WrappedMap.Count * 2];
107+
object[] result = new object[_wrappedMap.Count * 2];
108108
int i = 0;
109-
foreach (KeyValuePair<TKey, TValue> e in WrappedMap)
109+
foreach (KeyValuePair<TKey, TValue> e in _wrappedMap)
110110
{
111111
result[i++] = await (persister.IndexType.DisassembleAsync(e.Key, Session, null, cancellationToken)).ConfigureAwait(false);
112112
result[i++] = await (persister.ElementType.DisassembleAsync(e.Value, Session, null, cancellationToken)).ConfigureAwait(false);

0 commit comments

Comments
 (0)