Question

J'utilise actuellement un BehaviorExtensionElement pour charger un ServiceBehavior où la méthode ApplyDispatchBehavior est configuré comme:

    public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
    {
        WorkflowServiceHost host = serviceHostBase as WorkflowServiceHost;
        if (host != null)
        {
            UnityService.CreateContainer();
            host.WorkflowExtensions.Add<IUnityContainer>(delegate { return UnityService.CreateChildContainer(); });

            System.Diagnostics.Debug.WriteLine("NotificationService : Adding extension");

            WorkflowRuntimeBehavior wfbehavior = serviceDescription.Behaviors.Find<WorkflowRuntimeBehavior>();
            WorkflowRuntime runtime = wfbehavior.WorkflowRuntime;

            runtime.WorkflowStarted += runtime_WorkflowStarted;
            runtime.WorkflowCreated += runtime_WorkflowCreated;

            runtime.WorkflowUnloaded += runtime_WorkflowUnloaded;
            runtime.WorkflowSuspended += runtime_WorkflowSuspended;

            runtime.WorkflowCompleted += runtime_WorkflowCompleted;
            runtime.WorkflowAborted += runtime_WorkflowAborted;
            runtime.WorkflowTerminated += runtime_WorkflowTerminated;
        }
    }

Aucun des événements sont déclenchés qui ne va dire que la façon dont je fais référence l'instance d'exécution dans ce scénario particulier est erroné.

savoir Anyone d'une façon de le faire? Merci à l'avance.

Était-ce utile?

La solution

Le WorkflowRuntime et WorkflowRuntimeBehavior sont des artefacts WF3 mais votre question est étiqueté comme WF4 donc je présume que vous utilisez WF4.

WF4 la façon de le faire est d'utiliser un TrackingParticipant personnalisé et en ajoutant que la collection WorkflowExtensions du WorkflowServiceHost.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top