Ejemplo n.º 1
0
        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);
        }