The BusinessListBase class includes a default implementation of the DataPortal_Update()When I look into the code of BusinessListBase, there is the code:
method, which loops through all child objects (and deleted child objects) to ensure the
appropriate Child_XYZ method is called on each when the collection is being saved. Normally
this is the desired behavior, but you can override DataPortal_Update() if you need to take
control of the update process for some unusual scenario.
/// <summary>I thought those code in the old book (2005) should(?) be moved here. Chapter 7, Page 393.
/// Override this method to allow update of a business
/// object.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId = "Member")]
protected virtual void DataPortal_Update()
{
throw new NotSupportedException(Resources.UpdateNotSupportedException);
}
protected override void DataPortal_Update()Did I miss something?
{
RaiseListChangedEvents = false;
foreach (EditableChild item in DeletedList)
item.DeleteSelf();
DeletedList.Clear();
foreach (EditableChild item in this)
if (item.IsNew)
item.Insert(this);
else
item.Update(this);
RaiseListChangedEvents = true;
}
Chapter 15 of the hard copy book has pages 441-442 which discuss the Child_Update method.
This has the code you are looking for.
The DataPortal will call this for you automatically so you do not need a DataPortal_Update method anymore.
Joe
Copyright (c) Marimer LLC