If an orchestration calls another orchestration multiple times, use relationship to model the process. Examples where this apply may include
- A purchase order processing with each line item processed by another orchestration.
- An exception handling orchestration that is invoked anywhere in the project where an exception may occur
To illustrate, suppose orchestration (Orch1) calls orchestration (Orch2) n times, where n is determined at runtime. To model this, create two activities (Act1) and (Act2) in the same Bam definition file which have data items and business milestones corresponding to Orch1 and Orch2 respectively. Using the Tracking Profile Editor (TPE), map the data items and milestones as usual. In addition, follow the steps at http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_tracking_hgdm.asp to map the relationship. At runtime, the bam_Act1_AllRelationships view contains the mapping between instances of Act1 and Act2. Using this view and the bam_<ViewName>_<ActivityName>_View views for both Act1 and Act2, you can create queries to give information that you need for the entire process.
Another situation where modelling relationship may be more natural is when there are two different activities, like purchase order processing and shipment processing, and a single view is not what the user is after. At the same time, the user wants to relate these two activities in a way so that one can go from a purchase order number to find the corresponding shipment record.
If there are multiple orchestrations but each orchestration is called only once, use continuation to model. The view that comes with the deployment of Bam spans the entire project. Note that in this case only one activity is needed. Other situations where continuation may be used is when events are sent from different artifacts, like pipelines and customized code. The Bam End-To-End (BizTalk sample) in the SDK shows how continuation is used to monitor events from pipelines across to orchestrations: http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_bam_vgrs.asp