There's a valuable concept called "unit of work" that can enter in here. There are other names for it as well, but this is the name I prefer.
The idea is that you have a form that requires numerous root business objects to work - this may be 1+ editable business objects and 1+ read-only objects like name/value lists.
You don't want to go across the wire for each object - understandably.
So create a "unit of work" object that goes to the server, gets all the required objects, and brings them back. This UOW object can be created by subclassing ReadOnlyBase or CommandBase. If you are only retrieving data I'd use ROB, and if you are also updating data I'd use CB.
Either way, your root objects don't change - you are simply creating another object to "ferry them over the network" in a single server call.
RockfordLhotka:... If you are only retrieving data I'd use ROB, and if you are also updating data I'd use CB.
Either way, your root objects don't change - you are simply creating another object to "ferry them over the network" in a single server call.
I think this is where I have perhaps gone awry of the intended model, but it seems to work.
I started out using CommandBase object for UOW type operations, and then discovered I could use a BusinessBase derived class instead to compose these "root" objects together and get other benefits (like my UOW can now expose bindable properties, have validation rules, etc.).
Since my UOW's are now also BusinessBase objects, they themselves can also be composed into higher level UOW's, etc. One of the biggest benefits is that we can combine transactions server-side, which was virtually impossible in our legacy software.
This is pretty much the model I have been "preaching" for the last few years. Call it Unit Of Work (UOW) or Use Case Controller (UCC) it is the same idea. Use a Regular Business Base BO to be the parent object for the use case and have it gather up all the other objects when it is fetched. It can also co-ordinate the Update/Insert/Delete portion of the use case.
Joe
Copyright (c) Marimer LLC