EntityViews And RelatedCollection ListChanged not firing for newly added entities.

Posts   
 
    
Jayro
User
Posts: 14
Joined: 15-Nov-2006
# Posted on: 02-Jan-2007 20:24:12   

WITHDRAWN - My apologies Solution at the bottom:

Problem: I am working in a totally disconnected environment. I want to be able to work with my entity collection by adding new items, changing existing items, and deleting the items them via my GUI that is databound to the view. And then persist only once. Problem is that the ListChanged event does not seem to fire for newly added (not persisted entities).

I have tried to add the entities in different ways. Tried the AddNew on the RelatedCollection, and via the ((IBindingList)EntityView).AddNew(), and I have had no success. Once I persist the collection, all the events fire fine.

Is this by design? Any ideas on how I can get those events to Fire for my new entities? ICollectionMaintentence was my first thought, but it is an internal interface, and I cannot easily get to it.

I am using the 2.0 version of the app, and I am using the adapter model.

Solution: Problem was that filter was depending on default value to be set, and it was not, once I set that everything worked like a charm. Got better luck and fewer event noise when I used the following form when manually changing an EntityView.

ObjectType object = ((IBindingList)EntityView).AddNew as ObjectType if( object != null) { ((IEditableObject)object).BeginEdit(); <Make all your changes to your object> ((IEditableObject)object).EndEdit(); }

This more closely mimics what UI would do behind the scenes via DataBinding.