protected virtual void WriteWebServiceDescriptorTypeAttribute(XmlDictionaryWriter writer, WebServiceDescriptor webServiceDescriptor)
        {
            var prefix = writer.LookupPrefix(Namespace);

            if (string.IsNullOrEmpty(prefix))
            {
                // this is added for testing purposes
                writer.WriteXmlnsAttribute(Prefix, Namespace);
                prefix = Prefix;
            }
            var type = $"{prefix}:{webServiceDescriptor.GetType().Name.Replace("Descriptor", string.Empty)}Type";

            writer.WriteAttributeString(XsiConstants.Prefix, XsiConstants.Attributes.Type, XsiConstants.Namespace, type);
        }
 protected virtual void WriteWebServiceDescriptorChildren(XmlDictionaryWriter writer, WebServiceDescriptor webServiceDescriptor)
 {
     WriteLogicalServiceNamesOffered(writer, webServiceDescriptor.IssuerNames);
     WriteTokenTypesOffered(writer, webServiceDescriptor.TokenTypesOffered);
     WriteClaimDialectsOffered(writer, webServiceDescriptor.ClaimDialectsOffered);
     WriteClaimTypes(writer, Prefix, Elements.ClaimTypesOffered, Namespace, webServiceDescriptor.ClaimTypesOffered);
     WriteClaimTypes(writer, Prefix, Elements.ClaimTypesRequested, Namespace, webServiceDescriptor.ClaimTypesRequested);
     _ = writer.TryWriteElementValue(Elements.AutomaticPseudonyms, Namespace, webServiceDescriptor.AutomaticPseudonyms);
     WsAddressingSerializer.WriteEndpointReferenceCollection(writer, Elements.TargetScopes, Namespace, webServiceDescriptor.TargetScopes);
 }
        protected virtual void WriteWebServiceDescriptorAttributes(XmlDictionaryWriter writer, WebServiceDescriptor webServiceDescriptor)
        {
            if (webServiceDescriptor == null)
            {
                return;
            }

            WriteWebServiceDescriptorTypeAttribute(writer, webServiceDescriptor);

            _ = writer.TryWriteAttributeValue(Attributes.ServiceDisplayName, webServiceDescriptor.DisplayName);
            _ = writer.TryWriteAttributeValue(Attributes.ServiceDescription, webServiceDescriptor.Description);
        }
        protected virtual bool TryReadWebServiceDescriptorChild(XmlDictionaryReader reader, WebServiceDescriptor webServiceDescriptor)
        {
            if (TryReadLogicalServiceNamesOffered(reader, out var logicalServiceNamesOffered))
            {
                webServiceDescriptor.IssuerNames.AddRange(logicalServiceNamesOffered);
            }
            else if (TryReadTokenTypesOffered(reader, out var tokenTypesOffered))
            {
                webServiceDescriptor.TokenTypesOffered.AddRange(tokenTypesOffered);
            }
            else if (TryReadClaimDialectsOffered(reader, out var claimDialectsOffered))
            {
                webServiceDescriptor.ClaimDialectsOffered.AddRange(claimDialectsOffered);
            }
            else if (TryReadClaimTypes(reader, Elements.ClaimTypesOffered, Namespace, out var claimTypesOffered))
            {
                webServiceDescriptor.ClaimTypesOffered.AddRange(claimTypesOffered);
            }
            else if (TryReadClaimTypes(reader, Elements.ClaimTypesRequested, Namespace, out var claimTypesRequested))
            {
                webServiceDescriptor.ClaimTypesRequested.AddRange(claimTypesRequested);
            }
            else if (TryReadAutomaticPseudonyms(reader, out var automaticPseudonyms))
            {
                webServiceDescriptor.AutomaticPseudonyms = automaticPseudonyms;
            }
            else if (WsAddressingSerializer.TryReadEndpointReferenceCollection(reader, Elements.TargetScopes, Namespace, out var targetScopes))
            {
                webServiceDescriptor.TargetScopes.AddRange(targetScopes);
            }
            else
            {
                return(base.TryReadRoleDescriptorChild(reader, webServiceDescriptor));
            }

            return(true);
        }