protected XmlObjectSerializer GetSerializer(WebContentFormat msgfmt, bool isWrapped, MessagePartDescription part)
        {
            if (part.Type == typeof(void))
            {
                return(null); // no serialization should be done.
            }
            switch (msgfmt)
            {
            case WebContentFormat.Xml:
                if (xml_serializer == null)
                {
                    xml_serializer = isWrapped ? new DataContractSerializer(part.Type, part.Name, part.Namespace) : new DataContractSerializer(part.Type);
                }
                return(xml_serializer);

            case WebContentFormat.Json:
                // FIXME: after name argument they are hack
                if (json_serializer == null)
#if MOONLIGHT
                { json_serializer = new DataContractJsonSerializer(part.Type); }
#else
                { json_serializer = isWrapped ? new DataContractJsonSerializer(part.Type, BodyName ?? part.Name, null, 0x100000, false, null, true) : new DataContractJsonSerializer(part.Type); }
#endif
                return(json_serializer);

            default:
                throw new NotImplementedException(msgfmt.ToString());
            }
        }
Beispiel #2
0
		protected XmlObjectSerializer GetSerializer (WebContentFormat msgfmt, bool isWrapped, MessagePartDescription part)
		{
			if (part.Type == typeof (void))
				return null; // no serialization should be done.

			switch (msgfmt) {
			case WebContentFormat.Xml:
				if (xml_serializer == null)
					xml_serializer = isWrapped ? new DataContractSerializer (part.Type, part.Name, part.Namespace) : new DataContractSerializer (part.Type);
				return xml_serializer;
			case WebContentFormat.Json:
				// FIXME: after name argument they are hack
				if (json_serializer == null)
					json_serializer = isWrapped ? new DataContractJsonSerializer (part.Type, BodyName ?? part.Name, null, 0x100000, false, null, true) : new DataContractJsonSerializer (part.Type);
				return json_serializer;
			default:
				throw new NotImplementedException (msgfmt.ToString ());
			}
		}
Beispiel #3
0
 public override string ToString()
 {
     return(String.Concat(Name, ": WebContentFormat=", format.ToString()));
 }