Adding A Child To Collection....

Adding A Child To Collection....

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


vbkevin posted on Monday, February 23, 2009

Can someone baby me through this.... I am using the 3.6 framework. I am guessing that it would... So if I had

Order (BusinessBase)
LineItems (BusinessListBase<LineItems,LineItem>)
LineItem (BusinessBase)


I am guessin that there needs to be a method in LineItems called AddLineItem( string description, ect...).  Here is where the LineItem.Add(blah,blah) would be called.  Anyone have some sample code?

Thanks.

Fintanv replied on Tuesday, February 24, 2009

To allow adding via something like a grid you will want to override AddNewCore in your collection.

Your suggestion to provide an add method is also fine:

LineItem AddLineItem(string description, int val)
{
    LineItem child = LineItem.NewLineItem(description, val);
    this.Add(child);
    return child;
}

Copyright (c) Marimer LLC