Save

Save

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


KJosh posted on Thursday, December 18, 2008

Hi,
   1) In my aspx page, I have two sections with two Apply buttons one for each section. In first section displaying the object A details, second part contains object B details.  Apply data only when clicking on Apply buttons. The object structure is like the below:
Main Object: Business Base
    Object A : BusinessListBase
    ObjectB : BusinessListBase. ObjectA, Object B are properties of Main Object.
  Coming to the aspx page, I have added 2 items to Object A collection. After that added added one item to object B collection. Then clicking the Apply button on the first part(Object A collection). This time after saving the Object A data into database, CSLA saving the Object B record also into the database eventhough they did not enter any information for that record(Because In memory I created the Object B). Due to this CSLA, creating the some unnecessary records.
I am doing the save like this:
 MainObject.Save();
   Could we save only one particular object related to Save instead of saving the all in memory objects.
Thanks in advance

SonOfPirate replied on Friday, December 19, 2008

Keeping in mind that your objects should reflect the use case, it sounds like you should not be calling MainObject.Save() because this will behave exactly as described.  Instead, call ObjectA.Save() or ObjectB.Save() based on which button was clicked.

 

Copyright (c) Marimer LLC