protected override void CacheMetadata(NativeActivityMetadata metadata) { metadata.SetVariablesCollection(this.Variables); metadata.SetImplementationVariablesCollection( new Collection <Variable> { this.currentCompensationId, this.currentCompensationToken, // Add the variables which are only used by the secondary root this.compensationId }); if (this.Body != null) { metadata.SetChildrenCollection(new Collection <Activity> { this.Body }); } // Declare the handlers as public children. if (this.CompensationHandler != null) { metadata.AddImportedChild(this.CompensationHandler); } if (this.ConfirmationHandler != null) { metadata.AddImportedChild(this.ConfirmationHandler); } if (this.CancellationHandler != null) { metadata.AddImportedChild(this.CancellationHandler); } Collection <Activity> implementationChildren = new Collection <Activity>(); if (!this.IsSingletonActivityDeclared(CompensationActivityStrings.WorkflowImplicitCompensationBehavior)) { WorkflowCompensationBehavior workflowCompensationBehavior = new WorkflowCompensationBehavior(); this.DeclareSingletonActivity(CompensationActivityStrings.WorkflowImplicitCompensationBehavior, workflowCompensationBehavior); implementationChildren.Add(workflowCompensationBehavior); metadata.AddDefaultExtensionProvider(CreateCompensationExtension); } // Clear the cached handler values as workflow definition could be updated. CompensationParticipant = null; implementationChildren.Add(CompensationParticipant); metadata.SetImplementationChildrenCollection(implementationChildren); }
protected override void CacheMetadata(NativeActivityMetadata metadata) { metadata.SetVariablesCollection(this.Variables); metadata.SetImplementationVariablesCollection(new Collection <Variable> { this.currentCompensationId, this.currentCompensationToken, this.compensationId }); if (this.Body != null) { metadata.SetChildrenCollection(new Collection <Activity> { this.Body }); } if (this.CompensationHandler != null) { metadata.AddImportedChild(this.CompensationHandler); } if (this.ConfirmationHandler != null) { metadata.AddImportedChild(this.ConfirmationHandler); } if (this.CancellationHandler != null) { metadata.AddImportedChild(this.CancellationHandler); } Collection <Activity> implementationChildren = new Collection <Activity>(); if (!base.IsSingletonActivityDeclared("Activities.Compensation.WorkflowImplicitCompensationBehavior")) { WorkflowCompensationBehavior activity = new WorkflowCompensationBehavior(); base.DeclareSingletonActivity("Activities.Compensation.WorkflowImplicitCompensationBehavior", activity); implementationChildren.Add(activity); metadata.AddDefaultExtensionProvider <CompensationExtension>(new Func <CompensationExtension>(this.CreateCompensationExtension)); } this.CompensationParticipant = null; implementationChildren.Add(this.CompensationParticipant); metadata.SetImplementationChildrenCollection(implementationChildren); }