Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make IPersistentCollection.GetSnapshot() return object instead of ICo…

…llection. Some of the implementations return sets, and when those are BCL sets they don't implement non-generic ICollection. Since the contents of the snapshots are never accessed outside each type of persistent collection (and probably never should be), we might as well make it a completely opaque object.
  • Loading branch information...
commit f4c3e2e3955d05472e669e16e965b6bd091567a4 1 parent 2d324e0
Oskar Berggren oskarb authored
2  src/NHibernate/Collection/AbstractPersistentCollection.cs
View
@@ -797,7 +797,7 @@ public virtual object GetIdentifier(object entry, int i)
public abstract IEnumerable Entries(ICollectionPersister persister);
- public abstract ICollection GetSnapshot(ICollectionPersister persister);
+ public abstract object GetSnapshot(ICollectionPersister persister);
public abstract bool EqualsSnapshot(ICollectionPersister persister);
2  src/NHibernate/Collection/Generic/PersistentGenericMap.cs
View
@@ -30,7 +30,7 @@ public PersistentGenericMap(ISessionImplementor session, IDictionary<TKey, TValu
gmap = map;
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
EntityMode entityMode = Session.EntityMode;
Dictionary<TKey, TValue> clonedMap = new Dictionary<TKey, TValue>(map.Count);
2  src/NHibernate/Collection/Generic/PersistentGenericSet.cs
View
@@ -87,7 +87,7 @@ public override bool RowUpdatePossible
get { return false; }
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
var entityMode = Session.EntityMode;
var clonedSet = new SetSnapShot<T>(set.Count);
2  src/NHibernate/Collection/IPersistentCollection.cs
View
@@ -251,7 +251,7 @@ public interface IPersistentCollection
/// <summary>
/// Return a new snapshot of the current state of the collection
/// </summary>
- ICollection GetSnapshot(ICollectionPersister persister);
+ object GetSnapshot(ICollectionPersister persister);
/// <summary>
/// To be called internally by the session, forcing
2  src/NHibernate/Collection/PersistentArrayHolder.cs
View
@@ -67,7 +67,7 @@ public override object GetValue()
return array;
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
EntityMode entityMode = Session.EntityMode;
2  src/NHibernate/Collection/PersistentBag.cs
View
@@ -132,7 +132,7 @@ private static int CountOccurrences(object element, IList list, IType elementTyp
return result;
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
EntityMode entityMode = Session.EntityMode;
List<object> clonedList = new List<object>(bag.Count);
4 src/NHibernate/Collection/PersistentIdentifierBag.cs
View
@@ -196,7 +196,7 @@ public override bool EqualsSnapshot(ICollectionPersister persister)
public override bool IsSnapshotEmpty(object snapshot)
{
- return ((ICollection) snapshot).Count == 0;
+ return ((ISet<SnapshotElement>) snapshot).Count == 0;
}
public override IEnumerable GetDeletes(ICollectionPersister persister, bool indexIsFormula)
@@ -271,7 +271,7 @@ public override object ReadFrom(IDataReader reader, ICollectionPersister persist
return element;
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
EntityMode entityMode = Session.EntityMode;
2  src/NHibernate/Collection/PersistentList.cs
View
@@ -51,7 +51,7 @@ public PersistentList(ISessionImplementor session, IList list) : base(session)
IsDirectlyAccessible = true;
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
EntityMode entityMode = Session.EntityMode;
2  src/NHibernate/Collection/PersistentMap.cs
View
@@ -42,7 +42,7 @@ public PersistentMap(ISessionImplementor session, IDictionary map) : base(sessio
IsDirectlyAccessible = true;
}
- public override ICollection GetSnapshot(ICollectionPersister persister)
+ public override object GetSnapshot(ICollectionPersister persister)
{
EntityMode entityMode = Session.EntityMode;
Hashtable clonedMap = new Hashtable(map.Count);
Please sign in to comment.
Something went wrong with that request. Please try again.