public MetadataConfig GetEndpointConfig(string contentType) { contentType = contentType.ToLowerSafe(); switch (contentType) { case MimeTypes.Soap11: return(this.Soap11); case MimeTypes.Soap12: return(this.Soap12); case MimeTypes.Xml: return(this.Xml); case MimeTypes.Json: return(this.Json); case MimeTypes.Jsv: return(this.Jsv); } var format = ContentFormat.GetContentFormat(contentType); return(Custom.Create(format)); }
public void Register(string contentType, StreamSerializerDelegate streamSerializer, StreamDeserializerDelegate streamDeserializer) { if (contentType.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(contentType)); } var format = ContentFormat.GetContentFormat(contentType); var normalizedContentType = ContentFormat.NormalizeContentType(contentType); ContentTypeFormats[format] = normalizedContentType; SetContentTypeSerializer(normalizedContentType, streamSerializer); SetContentTypeDeserializer(normalizedContentType, streamDeserializer); }
public void RegisterAsync(string contentType, StreamSerializerDelegateAsync streamSerializer, StreamDeserializerDelegateAsync streamDeserializer) { if (contentType.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(contentType)); } var format = ContentFormat.GetContentFormat(contentType); var normalizedContentType = ContentFormat.NormalizeContentType(contentType); ContentTypeFormats[format] = normalizedContentType; if (streamSerializer != null) { ContentTypeSerializersAsync[normalizedContentType] = streamSerializer; } if (streamDeserializer != null) { ContentTypeDeserializersAsync[normalizedContentType] = streamDeserializer; } }