CSLA .NET

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

Lists and MarkAsChild

rated by 0 users
This post has 1 Reply | 0 Followers

Top 50 Contributor
Posts 147
vdhant Posted: Thu, Jan 1 2009 8:34 AM
Hi guys
When adding BO's to a BO list i can't for the life of me find where it sets the items that are being added to the list as child objects (i.e. calling MarkAsChild). Does this mean you should manually call MarkAsChild before you put a BO in the list or am i missing something.

The reason for asking is because BusinessListBase calls child.DeleteChild(); which intern checks to see if the child object being deleted is a child object. But i can't see where it is setting the BO's as children when adding them to the list. Hence it would seem that this should throw an exception all the time unless one manually calls MarkAsChild before adding a BO's to the list.

Cheers
Anthony

Top 500 Contributor
Posts 27

Hi Anthony,

The BusinessListBase does not MarkAsChild.

You need to construct your child objects as children.... that is, you need to use the Child_Fetch method (which will mark the object as a child), or call MarkAsChild explicity in your constructor (if you are not using the child dataportal stuff).

Page 1 of 1 (2 items) | RSS

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?
Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems