DataPortal_Delete on BusinessBindingListBase

DataPortal_Delete on BusinessBindingListBase

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


tiago posted on Wednesday, December 07, 2011

Hi Rocky,

Looking at BusinessBindingListBase<T,C> we can find DataPortal_Delete as follows

protected virtual void DataPortal_Delete(object criteria)
    Member of Csla.BusinessBindingListBase<T,C>

Summary:
Override this method to allow immediate deletion of a business object.

Parameters:
criteria: An object containing criteria values to identify the object.

Note BusinessListBase<T,C> doesn't include this method.

1) On p. 52 of Using CSLA4 - Data Access ebook DataPortal_Delete is referred as used on an Editable Root object.

2) I can find only one example of DataPortal_Delete being used in a *ListBase collection:

On EncapsulatedInvoke solution, the class SkillEditList has a DataPortal_Delete method but it's commented.

3) I feel a bit confused as I always thought it wasn't used in collections. Does the DataPortal use the Delete method on collections?

JonnyBee replied on Thursday, December 08, 2011

Hi,

A <list>.Save() will only ever call DataPortal_Update or <objectFactory>.Update.

But a DataPortal will call the BO with the "verb" that you typically use in a "static factory method".

So for example your code may call DataPortal.Delete<listType>(criteria)  on a list object that will look for a DataPortal_Delete or <objectFactory>.Delete method on the data access side. And DataPortal.Fetch<T> or DataPortal.Create<T> acts similar.

tiago replied on Thursday, December 08, 2011

Hi Jonny,

After the original post I noticed p. 122 of Using CSLA4 - Data Access ebook refers DataPortal_Delete being used by an Editable Root List.

DataPortal.Delete<List>(crit)

This triggers a call to

private void DataPortal_Delete(Criteria crit)

This means the Editable Root List will delete itself according to crit criteria.

I have only one remaining question: does it also work on Editable Child List? If I call

DataPortal.DeleteChild<List>(crit)

will this triggers a call to

private void Child_Delete(Criteria crit)

JonnyBee replied on Friday, December 09, 2011

Hi,

DataPortal do not have a DeleteChild method.

Copyright (c) Marimer LLC