--
You received this message because you are subscribed to the Google Groups "Npgsql Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to npgsql-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi guys.I believe this behavior matches SqlParameterCollection. It's been a few months since I wrote that, and I don't have time to double check at the moment. But it's also important because it allows a parameter to invalidate its collection's lookup indexes when its name is changed.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Data.SqlClient; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { SqlCommand c = new SqlCommand(); SqlParameter p1 = new SqlParameter(); c.Parameters.Add(p1); SqlCommand c2 = new SqlCommand(); c2.Parameters.Add(p1); } } }
You don't reset the parent in the parameters you remove with this.InternalList.Clear(). Classic mistake with IList.Clear() implementations ;)
/// <summary>/// Removes all items from the collection./// </summary>public override void Clear(){NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Clear");this.InternalList.Clear();this.InvalidateHashLookups();}
------------------------------------------------------------------------
Lead developer of LLBLGen Pro (O/R mapper/designer) and ORM Profiler.
http://www.llblgen.com | http://www.ormprofiler.com
Blog: http://weblogs.asp.net/fbouma
Twitter: http://twitter.com/FransBouma
------------------------------------------------------------------------
Pull: https://github.com/npgsql/Npgsql/pull/234
Also cleaned up the Remove* methods, as they re-implemented the same things 6 times (and each time using slightly different constructs, they now all end up in 1 method).
Hopefully this resolves the issue. Cheers, :)
Frans