Skip to content

Commit 7ddce60

Browse files
committed
Avoid Iesi-specific collection methods.
1 parent b72c5cc commit 7ddce60

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

src/NHibernate.Test/NHSpecificTest/NH1028/Fixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void CanLoadCollectionUsingLeftOuterJoin()
5151
Assert.AreEqual (shipName, loadedShip.Name);
5252
}
5353

54-
Assert.IsTrue (loadedItem.Containers.IsEmpty);
54+
Assert.That(loadedItem.Containers, Is.Empty);
5555
}
5656
using (ISession s = OpenSession())
5757
{

src/NHibernate.Test/NHSpecificTest/NH1810/Children.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ public Children(ICollection<Child> initialValues) : base(initialValues)
5353
behaviour = new ChildrenBehaviour(this);
5454
}
5555

56-
public Children(ICollection initialValues) : base(initialValues)
57-
{
58-
behaviour = new ChildrenBehaviour(this);
59-
}
6056

6157
public Children(ICollection<Child> initialValues, IComparer<Child> comparer) : base(initialValues, comparer)
6258
{

src/NHibernate/Mapping/AbstractAuxiliaryDatabaseObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public IDictionary<string, string> Parameters
4747
public bool AppliesToDialect(Dialect.Dialect dialect)
4848
{
4949
// empty means no scoping
50-
return dialectScopes.IsEmpty || dialectScopes.Contains(dialect.GetType().FullName);
50+
return dialectScopes.Count == 0 || dialectScopes.Contains(dialect.GetType().FullName);
5151
}
5252

5353
public abstract string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema);

src/NHibernate/Persister/Collection/AbstractCollectionPersister.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.Data;
5-
using System.Data.Common;
5+
using System.Data.Common;
6+
using System.Linq;
67
using System.Text;
78
using NHibernate.AdoNet;
89
using NHibernate.Cache;
@@ -620,16 +621,12 @@ private ICollectionInitializer GetSubselectInitializer(object key, ISessionImple
620621
else
621622
{
622623
// Take care of any entities that might have
623-
// been evicted!
624-
List<EntityKey> keysToRemove = new List<EntityKey>(subselect.Result.Count);
625-
foreach (EntityKey entityKey in subselect.Result)
626-
{
627-
if (!persistenceContext.ContainsEntity(entityKey))
628-
{
629-
keysToRemove.Add(entityKey);
630-
}
631-
}
632-
subselect.Result.RemoveAll(keysToRemove);
624+
// been evicted!
625+
List<EntityKey> keysToRemove = subselect.Result
626+
.Where(entityKey => !persistenceContext.ContainsEntity(entityKey)).ToList();
627+
628+
foreach (var entityKey in keysToRemove)
629+
subselect.Result.Remove(entityKey);
633630

634631
// Run a subquery loader
635632
return CreateSubselectInitializer(subselect, session);

0 commit comments

Comments
 (0)