Managed child which is a composite?Managed child which is a composite?
Old forum URL: forums.lhotka.net/forums/t/6533.aspx
ajj3085 posted on Friday, February 27, 2009
Hi,
I'm slowing move to using managed child properties, due to the code savings. There's one area where I have a concern, and that's a BusinessBase object which is a composite. It's declared like this:
public abstract class LineItemContainer :
BusinessBase<LineItemContainer>,
IEnumerable<LineItemContainer>,
Csla.Core.IParent,
ICustomTypeDescriptor,
ILineItem
{ }
Children in the node types are stored in a simple subclass of BindingList<LineItemContainer>, and deleted items are stored as List<LineItemContainer>. Is there any guidence on how this pattern should be implemented if you want to use managed child properites?
RockfordLhotka replied on Friday, February 27, 2009
I think you are in uncharted waters Andy...
You can declare private properties with managed backing fields, and perhaps that can help? Declare a private property to manage the lists, and expose them in a separate public property?
ajj3085 replied on Monday, March 02, 2009
Yes, I am, but it does seem to work pretty nicely.
I may give that a shot. I think at this point I'm leaning to leaving LineItem children as unmanaged; it should still be able to contain other managed properties, but this part took a while to get working so maybe I should just leave well enough alone.
Copyright (c) Marimer LLC