Mixing managed and unmanaged child objects?

Mixing managed and unmanaged child objects?

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


ajj3085 posted on Wednesday, September 09, 2009

Hi,

There's an object graph which I'd like to update to use managed properties. Now, i've already started moving some of the child objects to use managed properties themselves, but I'm hesitent to change the root BO to do so.

The reason is that one child object I won't be able move to a managed child... at least, I'd rather not given that its fairly complex.

The one child in this case is a BusinessBase subclass, which itself has many subclasses (its no longer generic after the initial base). The reason is that I've implemented a composite pattern on this particular class... so its both directly a child, and also a container for n-levels of other child objects, each with their own distinct behaviors but mostly similar properties.

If I move everything else to managed properties, will it be safe to leave this one child as an unmanaged property, or will there be some problems mixing the two styles? This is one of the most complex areas of my application, and also the most important and widely used, so I need to be exteremly careful if I proceed.

rsbaker0 replied on Wednesday, September 09, 2009

I've been freely mixing managed and unmanaged child objects almost since managed objects were introduced. I had a significant code base at that time and wanted to "evolve" into the managed world versus ripping everything up.

It seems to work fine. You'll have to have some hybrid versions of overrides that check the FieldManager (e.g. IsDirty, IsValid, etc.) so they check your unmanaged children, and you need to explicitly persist them versus whatever child data portal support you get for managed children, but otherwise it works great.

ajj3085 replied on Thursday, September 10, 2009

Great, that's what I was hoping to hear!

Copyright (c) Marimer LLC