Checking Dirty Child Collections

Posts   
 
    
Kodiak
User
Posts: 92
Joined: 13-Apr-2009
# Posted on: 13-Apr-2009 10:59:43   

Hi,

In an application I'm try to keep track of whether an entity or any of it's related child collections have been modified since being loaded.

The entity itself has an IsDirty property but is there any easy way to check whether any of the child collections are dirty without explicitly checking them

e.g. to avoid doing the following:

If Product.IsDirty OrElse Product.ProductOptions.DirtyEntities.Count > 0 

The aim is to ultimately display the usual "You have unsaved changes" style prompts but to do this without requiring an in-depth knowledge of the various collections that may be displayed.

Any ideas folks?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 13-Apr-2009 16:33:50   

Did you try the reletaed collection ListChanged event?