CSLA .NET

From Rockford Lhotka's Expert C# 2005 and VB 2005 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

Should i explicitly call MarkClean() in update method of editable child?

Last post 05-20-2008, 7:34 AM by ajj3085. 2 replies.
Sort Posts: Previous Next
  •  05-20-2008, 3:52 AM 23685

    Should i explicitly call MarkClean() in update method of editable child?

    I have a scenario where a BusinessBase class is having an editable child collection. I implemented the update method as internal for this child colletion which in turn calls internal methods for insert, delete or update of its editable child depending upon the flag values. Now my question is do i have to call MarkClean() or MarkOld() method explicitly in update method for this editable child?

  •  05-20-2008, 3:55 AM 23686 in reply to 23685

    Re: Should i explicitly call MarkClean() in update method of editable child?

    The version i am using is CSLA.net 3.0
  •  05-20-2008, 7:34 AM 23692 in reply to 23685

    Re: Should i explicitly call MarkClean() in update method of editable child?

    It depends on the operation.  For insert or update, MarkOld should be called.  The that will mark the object as both clean and old.. old meaning it exists in the database.

    For delete, MarkNew should be called.  It sets the instance as dirty and new, or not existing in the database.  Since clean tells you if the object has changed since it was loaded from the db and the instance doesn't exist in the db, it's by definition dirty.
View as RSS news feed in XML

Please contact Magenic for your .NET consulting and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems