Skip to content

Obsolete IdentitySet class #2356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/NHibernate.Test/UtilityTest/IdentitySetFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using NHibernate.Util;
using NUnit.Framework;

Expand All @@ -10,6 +9,8 @@ namespace NHibernate.Test.UtilityTest
/// <summary>
/// Test for the IdentityMap.
/// </summary>
// Since 5.3
[Obsolete("This class has no more usages and will be removed in a future version")]
[TestFixture]
public class IdentitySetFixture
{
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Async/Engine/Query/HQLQueryPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task PerformListAsync(QueryParameters queryParameters, ISessionImpl
}

IList combinedResults = results ?? new List<object>();
IdentitySet distinction = new IdentitySet();
var distinction = new HashSet<object>(ReferenceComparer<object>.Instance);
int includedCount = -1;
for (int i = 0; i < Translators.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public virtual Task OnDeleteAsync(DeleteEvent @event, CancellationToken cancella
{
return Task.FromCanceled<object>(cancellationToken);
}
return OnDeleteAsync(@event, new IdentitySet(), cancellationToken);
return OnDeleteAsync(@event, new HashSet<object>(ReferenceComparer<object>.Instance), cancellationToken);
}

public virtual async Task OnDeleteAsync(DeleteEvent @event, ISet<object> transientEntities, CancellationToken cancellationToken)
Expand Down Expand Up @@ -145,7 +145,7 @@ protected virtual async Task DeleteTransientEntityAsync(IEventSource session, ob
// NH different impl : NH-1895
if(transientEntities == null)
{
transientEntities = new HashSet<object>();
transientEntities = new HashSet<object>(ReferenceComparer<object>.Instance);
}
if (!transientEntities.Add(entity))
{
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Async/Hql/Ast/ANTLR/QueryTranslatorImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task<IList> ListAsync(ISessionImplementor session, QueryParameters

int size = results.Count;
var tmp = new List<object>();
var distinction = new IdentitySet();
var distinction = new HashSet<object>(ReferenceComparer<object>.Instance);

for ( int i = 0; i < size; i++ )
{
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Engine/Query/HQLQueryPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void PerformList(QueryParameters queryParameters, ISessionImplementor ses
}

IList combinedResults = results ?? new List<object>();
IdentitySet distinction = new IdentitySet();
var distinction = new HashSet<object>(ReferenceComparer<object>.Instance);
int includedCount = -1;
for (int i = 0; i < Translators.Length; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate/Event/Default/DefaultDeleteEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class DefaultDeleteEventListener : IDeleteEventListener
/// <param name="event">The delete event to be handled. </param>
public virtual void OnDelete(DeleteEvent @event)
{
OnDelete(@event, new IdentitySet());
OnDelete(@event, new HashSet<object>(ReferenceComparer<object>.Instance));
}

public virtual void OnDelete(DeleteEvent @event, ISet<object> transientEntities)
Expand Down Expand Up @@ -143,7 +143,7 @@ protected virtual void DeleteTransientEntity(IEventSource session, object entity
// NH different impl : NH-1895
if(transientEntities == null)
{
transientEntities = new HashSet<object>();
transientEntities = new HashSet<object>(ReferenceComparer<object>.Instance);
}
if (!transientEntities.Add(entity))
{
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public IList List(ISessionImplementor session, QueryParameters queryParameters)

int size = results.Count;
var tmp = new List<object>();
var distinction = new IdentitySet();
var distinction = new HashSet<object>(ReferenceComparer<object>.Instance);

for ( int i = 0; i < size; i++ )
{
Expand Down
3 changes: 2 additions & 1 deletion src/NHibernate/Util/IdentitySet.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace NHibernate.Util
{
/// <summary>
/// Set implementation that use reference equals instead of Equals() as its comparison mechanism.
/// </summary>
// Since 5.3
[Obsolete("This class has no more usages and will be removed in a future version")]
public class IdentitySet : ISet<object>
{
private IDictionary map;
Expand Down