Managed child BO properties

Managed child BO properties

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


ajj3085 posted on Thursday, September 04, 2008

Hi,

Just wanted to check to make sure this is supported, and if it is, if there are any known gotchas.

I have a BO which has a child BO (not a collection).  Not a big deal.. but you CAN set the child BO to any instance you'd like.  You can fetch or create an instance of the child BO via a public factory method.  Depending on whether or not it's new or old, it will either update the database or do nothing.

Thanks
Andy

skagen00 replied on Thursday, September 04, 2008

I have not really encountered any problems with using managed child properties.

ajj3085 replied on Thursday, September 04, 2008

Well, I haven't yet either, but this is the first case where the UI can actually set a child BO to a new instance. Smile [:)]  Usually it's get only, and you modify the properties on the child BO.

skagen00 replied on Thursday, September 04, 2008

Ahhh.

I use child objects that are not lists fairly infrequently, but one of them involved potentially swapping out a different implementation of an interface (child property of the root was this interface) based on a code selection on the root.

I ended up having to track some additional things on the root manually to facilitate data access as with children getting swapped in/out, potentially swapped out after creation (thus no deletion)... I could not find a way to automatically handle persistence in a perfectly graceful way via the framework. I think I kept a handle of the originally fetched object (in terms of the extra information kept in the root).

I'm sure that's not particularly helpful...

ajj3085 replied on Thursday, September 04, 2008

No, it is helpful.  In my case, the root BO is an "Insert only" kind of BO.  So I don't need to worry about some of the same things you did, but it's good to know that was the only extra work you had to do.  It sounds like I shouldn't have anything to worry about.

My only question now, and I'm going to dig into the Csla source, is will ChildCreate and ChildFetch honor the RunLocal attribute.. I'm creating a child on the client and don't need the app server to do so, and ChildCreate or Fetch seems most appropriate (since that will call MarkAsChild for me.. I hope!).

skagen00 replied on Thursday, September 04, 2008

That's a good question. I bet it honors the [RunLocal] of the root object. I'd have to look too, though.

ajj3085 replied on Thursday, September 04, 2008

It looks like it doesn't perform remoting at all, which in my case is fine. 

skagen00 replied on Thursday, September 04, 2008

Yep - just runs in whatever context it's in... so if the FetchChild<T>, CreateChild<T> occurred while on the server, it's on the server, if not, not.

Good to know.

Copyright (c) Marimer LLC