Пример #1
0
        private void AddInstanceExtension(WorkflowInstanceExtensionProvider extensionProvider)
        {
            Fx.Assert(this.instanceExtensions != null, "instanceExtensions should be setup by now");
            var newExtension = extensionProvider.ProvideValue();

            if (newExtension is SymbolResolver)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.SymbolResolverMustBeSingleton));
            }

            // for IWorkflowInstance we key off the type of the value, not the declared type
            if (!this.shouldSetInstanceForInstanceExtensions && newExtension is IWorkflowInstanceExtension)
            {
                this.shouldSetInstanceForInstanceExtensions = true;
            }
            if (!this.hasTrackingParticipant && extensionProvider.IsMatch <TrackingParticipant>(newExtension))
            {
                this.hasTrackingParticipant = true;
            }
            if (!this.hasPersistenceModule && extensionProvider.IsMatch <IPersistencePipelineModule>(newExtension))
            {
                this.hasPersistenceModule = true;
            }

            this.instanceExtensions?.Add(new KeyValuePair <WorkflowInstanceExtensionProvider, object>(extensionProvider, newExtension));

            WorkflowInstanceExtensionManager.AddExtensionClosure(newExtension, ref this.additionalInstanceExtensions, ref this.hasTrackingParticipant, ref this.hasPersistenceModule);
        }
Пример #2
0
        private void AddInstanceExtension(WorkflowInstanceExtensionProvider extensionProvider)
        {
            object obj2 = extensionProvider.ProvideValue();

            if (obj2 is SymbolResolver)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.SymbolResolverMustBeSingleton));
            }
            if (!this.shouldSetInstanceForInstanceExtensions && (obj2 is IWorkflowInstanceExtension))
            {
                this.shouldSetInstanceForInstanceExtensions = true;
            }
            if (!this.hasTrackingParticipant && extensionProvider.IsMatch <TrackingParticipant>(obj2))
            {
                this.hasTrackingParticipant = true;
            }
            if (!this.hasPersistenceModule && extensionProvider.IsMatch <IPersistencePipelineModule>(obj2))
            {
                this.hasPersistenceModule = true;
            }
            this.instanceExtensions.Add(new KeyValuePair <WorkflowInstanceExtensionProvider, object>(extensionProvider, obj2));
            WorkflowInstanceExtensionManager.AddExtensionClosure(obj2, ref this.additionalInstanceExtensions, ref this.hasTrackingParticipant, ref this.hasPersistenceModule);
        }