I have developed a Custom Collection of objects that implementsthe ITypedList interface, which allows a DataGrid to bind to thecollection while giving me control over the TableStyles. Theobjects within the collection implement isNew and isDirtyproperties.
The custom collection is populated by my Data Access Layer ( DAL).
The problem is that the user can remove records from thecollection ( using Remove and RemoveAt methods ). Since theobjects are no longer in the collection, the DAL can not deletethem from the DB.
I was planning on adding a private ArrayList to my collectionthat will store a copy of the original state of the collection.Since the custom collection is strongly typed, I can infer thatthe ArrayList will only contain objects of the desired type.
I was thinking of implementing a GetChanges method, similar tothat of a DataSet, that will compare the original members of thecollection ( from the ArrayList ) with the current members andreturn a list of only the objects that have been Created,Updated or Deleted.
Has anyone else thought of an elegant way to do this? Or am Ibarking up the wrong tree?
--------------------------------
From: Stephen Haeney
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>7d1JpvCBkkicuDQlZCMJew==</Id>