protected override void CacheMetadata(ActivityMetadata metadata)
 {
     if (string.IsNullOrEmpty(this.OperationName))
     {
         metadata.AddValidationError(System.ServiceModel.Activities.SR.MissingOperationName(base.DisplayName));
     }
     MessagingActivityHelper.ValidateCorrelationInitializer(metadata, this.correlationInitializers, false, base.DisplayName, this.OperationName);
     MessagingActivityHelper.AddRuntimeArgument(this.CorrelatesWith, "CorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In, metadata);
     this.InternalContent.CacheMetadata(metadata, this, this.OperationName);
     if (this.correlationInitializers != null)
     {
         for (int i = 0; i < this.correlationInitializers.Count; i++)
         {
             CorrelationInitializer initializer = this.correlationInitializers[i];
             initializer.ArgumentName = "Parameter" + i;
             RuntimeArgument argument = new RuntimeArgument(initializer.ArgumentName, Constants.CorrelationHandleType, ArgumentDirection.In);
             metadata.Bind(initializer.CorrelationHandle, argument);
             metadata.AddArgument(argument);
         }
     }
     if (!metadata.HasViolations)
     {
         this.internalReceive = this.CreateInternalReceive();
         this.InternalContent.ConfigureInternalReceive(this.internalReceive, out this.requestFormatter);
     }
     else
     {
         this.internalReceive  = null;
         this.requestFormatter = null;
     }
 }
Пример #2
0
 protected override void CacheMetadata(ActivityMetadata metadata)
 {
     if (string.IsNullOrEmpty(this.OperationName))
     {
         metadata.AddValidationError(System.ServiceModel.Activities.SR.MissingOperationName(base.DisplayName));
     }
     if (this.ServiceContractName == null)
     {
         string errorMessageOperationName = ContractValidationHelper.GetErrorMessageOperationName(this.OperationName);
         metadata.AddValidationError(System.ServiceModel.Activities.SR.MissingServiceContractName(base.DisplayName, errorMessageOperationName));
     }
     if (this.Endpoint == null)
     {
         if (string.IsNullOrEmpty(this.EndpointConfigurationName))
         {
             metadata.AddValidationError(System.ServiceModel.Activities.SR.EndpointNotSet(base.DisplayName, this.OperationName));
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(this.EndpointConfigurationName))
         {
             metadata.AddValidationError(System.ServiceModel.Activities.SR.EndpointIncorrectlySet(base.DisplayName, this.OperationName));
         }
         if (this.Endpoint.Binding == null)
         {
             metadata.AddValidationError(System.ServiceModel.Activities.SR.MissingBindingInEndpoint(this.Endpoint.Name, this.ServiceContractName));
         }
     }
     MessagingActivityHelper.ValidateCorrelationInitializer(metadata, this.correlationInitializers, false, base.DisplayName, this.OperationName);
     MessagingActivityHelper.AddRuntimeArgument(this.CorrelatesWith, "CorrelatesWith", System.ServiceModel.Activities.Constants.CorrelationHandleType, ArgumentDirection.In, metadata);
     MessagingActivityHelper.AddRuntimeArgument(this.EndpointAddress, "EndpointAddress", System.ServiceModel.Activities.Constants.UriType, ArgumentDirection.In, metadata);
     this.InternalContent.CacheMetadata(metadata, this, this.OperationName);
     if (this.correlationInitializers != null)
     {
         for (int i = 0; i < this.correlationInitializers.Count; i++)
         {
             CorrelationInitializer initializer = this.correlationInitializers[i];
             initializer.ArgumentName = "Parameter" + i;
             RuntimeArgument argument = new RuntimeArgument(initializer.ArgumentName, System.ServiceModel.Activities.Constants.CorrelationHandleType, ArgumentDirection.In);
             metadata.Bind(initializer.CorrelationHandle, argument);
             metadata.AddArgument(argument);
         }
     }
     if (!metadata.HasViolations)
     {
         if ((this.InternalContent is SendMessageContent) && MessageBuilder.IsMessageContract(((SendMessageContent)this.InternalContent).InternalDeclaredMessageType))
         {
             this.OperationUsesMessageContract = true;
         }
         this.internalSend = this.CreateInternalSend();
         this.InternalContent.ConfigureInternalSend(this.internalSend, out this.requestFormatter);
         if ((this.requestFormatter != null) && (this.lazyFormatter != null))
         {
             this.requestFormatter.Formatter = this.lazyFormatter;
         }
     }
     else
     {
         this.internalSend     = null;
         this.requestFormatter = null;
     }
 }