SetChildDirty Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Propagates change notifications, when there are no generated DateTime updates from the child.

Namespace:  Microsoft.CommerceServer.Runtime
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public MustOverride Sub SetChildDirty
'Usage
Dim instance As MappedStorageBase

instance.SetChildDirty()
public abstract void SetChildDirty()
public:
virtual void SetChildDirty() abstract
public abstract function SetChildDirty()

Remarks

SetChildDirty is called by the SetDirty implementations within child classes to propagate the dirty state upward, eventually up to base OrderGroup-derived classes. Parent class implementations use this notification to update local "last updated" DateTime properties, and potentially to optimize update queries to storage.

Root classes having no parent should implement this function as empty. Note that in the orders class hierarchy, only system-defined OrderGroup-derived classes can be root classes.

Examples

The following code example is a suggested way to implement SetChildDirty for a parent class that is itself contained within a parent class.

using Microsoft.CommerceServer.Runtime;
class MyClass : MappedStorageBase
{
  void SetChildDirty()
  {
    // Check to see if StorageLoadInProgress is set - if so, skip
    // processing of this call.
    if (!StorageLoadInProgress)
    {
      // If we have a local DateTime property that stores a "last
      // modified" time,
      // update it here with the current time (DateTime.Now).
      // Update with local time if the field is mapped to storage - it
      // will be
      // converted to UTC during marshaling. If there is such a field,
      // be sure to cache
      // the DateTime.Now value in a local variable, use the value to 
      //set the local property,
      // and pass the value to the parent through the other overloaded 
      //version of
      // SetChildDirty().
      // If this class is contained within a parent (e.g. an OrderForm
      // or OrderGroup),
      // notify that parent instance of a change in this class. Use the
      // overload that
      // contains DateTime if we generated a local DateTime.
      this.myParentRef.SetChildDirty();
    }
  }
} 

Permissions

See Also

Reference

MappedStorageBase Class

MappedStorageBase Members

SetChildDirty Overload

Microsoft.CommerceServer.Runtime Namespace

StorageLoadInProgress

SetDirty

SetChildDirty