internal string GetConfigKey(System.Type implementedContract)
 {
     if (this.reflectedContracts.Contains(implementedContract))
     {
         return(ServiceHost.ReflectedContractCollection.GetConfigKey(this.reflectedContracts[implementedContract]));
     }
     if (!this.behaviors.Contains(typeof(ServiceMetadataBehavior)) || !ServiceMetadataBehavior.IsMetadataImplementedType(implementedContract))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SfxReflectedContractKeyNotFound2", new object[] { implementedContract.FullName, string.Empty })));
     }
     return("IMetadataExchange");
 }
Пример #2
0
        public ServiceEndpoint AddServiceEndpoint(Type implementedContract, Binding binding, Uri address, Uri listenUri)
        {
            if (implementedContract == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("implementedContract"));
            }
            if (!implementedContract.IsDefined(typeof(ServiceContractAttribute), false))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.ServiceContractAttributeNotFound, new object[] { implementedContract.FullName })));
            }
            if (this.reflectedContracts == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.ReflectedContractsNotInitialized, new object[] { implementedContract.FullName })));
            }

            if (!reflectedContracts.Contains(implementedContract))
            {
                if (ServiceMetadataBehavior.IsMetadataImplementedType(implementedContract))
                {
                    if (!this.Description.Behaviors.Contains(
                            typeof(ServiceMetadataBehavior)))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.MetadataEndpointCannotBeAdded, new object[] { implementedContract.FullName })));
                    }
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.ReflectedContractKeyNotFound, new object[] { implementedContract.FullName, this.workflowDefinitionContext.WorkflowName })));
                }
            }
            ServiceEndpoint endpoint = base.AddServiceEndpoint(ContractDescription.GetContract(implementedContract).ConfigurationName, binding, address);

            if (listenUri != null)
            {
                listenUri          = base.MakeAbsoluteUri(listenUri, binding);
                endpoint.ListenUri = listenUri;
            }

            return(endpoint);
        }
 internal bool Contains(System.Type implementedContract)
 {
     return(this.reflectedContracts.Contains(implementedContract) || (this.behaviors.Contains(typeof(ServiceMetadataBehavior)) && ServiceMetadataBehavior.IsMetadataImplementedType(implementedContract)));
 }