Simulate the DataSet.Merge functionality for List objects

Simulate the DataSet.Merge functionality for List objects

Old forum URL: forums.lhotka.net/forums/t/4223.aspx


dstarkey posted on Wednesday, January 23, 2008

To all.

Is it possible to replicate the DataSet.Merge functionality within our list business objects.  I do not want to recreate the wheel if this has already been addressed.  I have a MasterList BO, and a CurrentList BO.   I would like to call a method  that could discover all of the inserted  and updated records that the current List has when compared to the Master List object.  Do I have to do this manually within a method of the MasterList object?  For example use a foreach/for construct and compare the key values of  each item in the Current list  to  the corresponding item of the Master list in order to determine if it is new or changed item?

Thanks for your help

Don

RockfordLhotka replied on Thursday, January 24, 2008

No, there's no merge concept built into BusinessListBase.

dstarkey replied on Monday, January 28, 2008

To Anyone,

The problem is that I have 1 file that must be submitted to an outside vendor once a week.  The  file (Master - Biz Obj) contains apprx 800 records and will continue to grow by about 10% a year.  The file holds the records of each employee enrolled in the program.  Weekly adjustments are made to this file (Master BO) based on Current database values that generate a new Master.  For example, employee changes must be logged, and new employees must be added to this file (BO).  So I am working from two list objects Master and Current.  I use the Current to upate the Master.  That is why I thought the DataSet.Merge functionality would have been ideal.  In looking at List Processing I saw where obj.IndexOf(item, StartingIdx) would have been a decent solution.  But the CSLA list processing does not implement this second IndexOf method.  IE I have to iterate through the entire (Master) list from the beginning for each Current list item, rather than starting at the last index found.  Is there a CSLA solution that I am overlooking??  Are DataSets a better solution to this problem??

Any suggestions of how to implement this solution is appreciated.  I do not know if this is possible within the CSLA framework.  Thanks in advance.

Don

SomeGuy replied on Monday, January 28, 2008

Does your Current list only contain adds and changes to Master? If not, why not delete Master and recreate it?

Alternately, do you have (or can add) a ModifiedOn field to your Current objects, and just get a list of objects that have changed since the Master was updated last?

E

 

simon_may replied on Tuesday, January 29, 2008

I do not fully understand the details of yorr problem, but it occurs to me that that if you sort both lists first by the same criteria you will not have to itterate through the second list time and again. Just keep two iterators moving forward.

Simon

Copyright (c) Marimer LLC