Revision: 5204
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5204&view=rev
Author: fabiomaulo
Date: 2010-09-22 22:11:09 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
Fix NH-2343
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Type/GenericBagType.cs
Modified: trunk/nhibernate/src/NHibernate/Type/GenericBagType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/GenericBagType.cs 2010-09-22 21:01:34 UTC (rev 5203)
+++ trunk/nhibernate/src/NHibernate/Type/GenericBagType.cs 2010-09-22 22:11:09 UTC (rev 5204)
@@ -40,7 +40,7 @@
public override System.Type ReturnedClass
{
- get { return typeof(IList<T>); }
+ get { return typeof(ICollection<T>); }
}
/// <summary>
@@ -53,16 +53,19 @@
/// </returns>
public override IPersistentCollection Wrap(ISessionImplementor session, object collection)
{
- return new PersistentGenericBag<T>(session, (IList<T>) collection);
+ return new PersistentGenericBag<T>(session, (ICollection<T>) collection);
}
- //TODO: Add() & Clear() methods - need to see if these should be refactored back into
- // their own version of Copy or a DoCopy. The Copy() method used to be spread out amongst
- // the various collections, but since they all had common code Add() and Clear() were made
- // virtual since that was where most of the logic was. A different/better way might be to
- // have a Copy on the base collection that handles the standard checks and then a DoCopy
- // that performs the actual copy.
+ protected override void Add(object collection, object element)
+ {
+ ((ICollection<T>) collection).Add((T) element);
+ }
+ protected override void Clear(object collection)
+ {
+ ((ICollection<T>)collection).Clear();
+ }
+
public override object Instantiate(int anticipatedSize)
{
return anticipatedSize <= 0 ? new List<T>() : new List<T>(anticipatedSize + 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|