Here is the problem... I load a collection using collection1.Load(query) call, then change the query, create another collection and load the second collection with the modified query: collection2.Load(query). The second call removes data from the collection1 and populates both collections with data from the second Load() call.
I think the problem is in the HookupQuery/InityQuery pair inside the generated collection class. These methods hookup the event handler to the query:
query.OnLoadEvent +=
but never remove the event handler. This code shoul be better changed to disconnect the event before attaching it:
query.OnLoadEvent -= new esDynamicQuery.QueryLoadedDelegate(OnQueryLoaded);
query.OnLoadEvent += new esDynamicQuery.QueryLoadedDelegate(OnQueryLoaded);
Is there a workaround for this problem or should I recreate a query for the second call?
Thanks,
Leonid
EntitySpaces | Twitter | BLOG | Please honor our Software License
Thank you Mike.
Just one more thought. Probably it's a good idea to implement IDisposable interface in ES classes. Then the event handler can be also released inside the Dispose method, so the collection can be removed from memory without disposing the query.