BusinessListBase.DataPortal_Update() missing in 3.6?

BusinessListBase.DataPortal_Update() missing in 3.6?

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


FrankM posted on Thursday, December 18, 2008

On the new book chapter 5,  Page 5-18,
The BusinessListBase class includes a default implementation of the DataPortal_Update()
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.

When I look into the code of BusinessListBase, there is the code:
    /// <summary>
    /// 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);
    }

I thought those code in the old book (2005) should(?) be moved here.   Chapter 7, Page 393.
protected override void DataPortal_Update()
{
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;
}

Did I miss something?

JoeFallon1 replied on Thursday, December 18, 2008

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

 

FrankM replied on Thursday, December 18, 2008

Interesting, found other posts:
http://forums.lhotka.net/forums/post/21703.aspx
http://forums.lhotka.net/forums/post/20169.aspx

Looks like I still need to create DP_Update in root list BO. Will look in the book tomorrow.

FrankM replied on Friday, December 19, 2008

That's FieldManager.UpdateChildren, not what I am looking for. I do need DataPortal_Update to call base.Child_Update as mentioned in those posts. Thanks Joe for your response.

Copyright (c) Marimer LLC