public ServiceDescription BuildServiceDescription(out IDictionary<string, ContractDescription> implementedContracts, out IList<Type> reflectedContracts) { ServiceDescriptionContext context = new ServiceDescriptionContext(); ServiceDescription description = new ServiceDescription(); ApplyBehaviors(description); context.ServiceDescription = description; Walker walker = new Walker(true); walker.FoundActivity += delegate(Walker w, WalkerEventArgs args) { IServiceDescriptionBuilder activity = args.CurrentActivity as IServiceDescriptionBuilder; if (activity == null) { return; } activity.BuildServiceDescription(context); }; walker.Walk(this.workflowDefinitionContext.GetWorkflowDefinition()); if (context.Contracts == null || context.Contracts.Count == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.NoContract))); } implementedContracts = context.Contracts; reflectedContracts = context.ReflectedContracts; return description; }
void IServiceDescriptionBuilder.BuildServiceDescription(ServiceDescriptionContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } WorkflowServiceBehavior workflowServiceBehavior = context.ServiceDescription.Behaviors.Find<WorkflowServiceBehavior>(); if (workflowServiceBehavior == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.NoWorkflowServiceBehavior))); } workflowServiceBehavior.AddressFilterMode = this.AddressFilterMode; workflowServiceBehavior.IgnoreExtensionDataObject = this.IgnoreExtensionDataObject; workflowServiceBehavior.IncludeExceptionDetailInFaults = this.IncludeExceptionDetailInFaults; workflowServiceBehavior.MaxItemsInObjectGraph = this.MaxItemsInObjectGraph; workflowServiceBehavior.UseSynchronizationContext = this.UseSynchronizationContext; workflowServiceBehavior.ValidateMustUnderstand = this.ValidateMustUnderstand; if (!string.IsNullOrEmpty(this.ConfigurationName)) { workflowServiceBehavior.ConfigurationName = this.ConfigurationName; } if (!string.IsNullOrEmpty(this.Name)) { workflowServiceBehavior.Name = this.Name; } if (!string.IsNullOrEmpty(this.Namespace)) { workflowServiceBehavior.Namespace = this.Namespace; } }