コード例 #1
0
 public SystemInterface.Runtime.Serialization.Json.IDataContractJsonSerializer Create(
     System.Type type,
     System.Collections.Generic.IEnumerable <System.Type> knownTypes,
     int maxItemsInObjectGraph,
     bool ignoreExtensionDataObject,
     System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate,
     bool alwaysEmitTypeInformation)
 {
     return(new SystemWrapper.Runtime.Serialization.Json.DataContractJsonSerializerWrap(
                type,
                knownTypes,
                maxItemsInObjectGraph,
                ignoreExtensionDataObject,
                dataContractSurrogate,
                alwaysEmitTypeInformation));
 }
        public DataContractJsonSerializerOperationFormatter(OperationDescription description, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool isWrapped, bool useAspNetAjaxJson, string callbackParameterName)
            : base(description, TypeLoader.DefaultDataContractFormatAttribute, new DataContractJsonSerializerOperationBehavior(description, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, useAspNetAjaxJson))
        {
            if (this.requestMessageInfo != null)
            {
                if (this.requestMessageInfo.WrapperName == null)
                {
                    isBareMessageContractRequest = true;
                }
                else
                {
                    this.requestMessageInfo.WrapperName      = JsonGlobals.rootDictionaryString;
                    this.requestMessageInfo.WrapperNamespace = XmlDictionaryString.Empty;
                }
            }

            if (this.replyMessageInfo != null)
            {
                if (this.replyMessageInfo.WrapperName == null)
                {
                    isBareMessageContractReply = true;
                }
                else
                {
                    if (useAspNetAjaxJson)
                    {
                        this.replyMessageInfo.WrapperName = JsonGlobals.dDictionaryString;
                    }
                    else
                    {
                        this.replyMessageInfo.WrapperName = JsonGlobals.rootDictionaryString;
                    }
                    this.replyMessageInfo.WrapperNamespace = XmlDictionaryString.Empty;
                }
            }

            if ((this.requestStreamFormatter != null) && (this.requestStreamFormatter.WrapperName != null))
            {
                this.requestStreamFormatter.WrapperName      = JsonGlobals.rootString;
                this.requestStreamFormatter.WrapperNamespace = string.Empty;
            }

            if ((this.replyStreamFormatter != null) && (this.replyStreamFormatter.WrapperName != null))
            {
                this.replyStreamFormatter.WrapperName      = JsonGlobals.rootString;
                this.replyStreamFormatter.WrapperNamespace = string.Empty;
            }
            this.isWrapped             = isWrapped;
            this.useAspNetAjaxJson     = useAspNetAjaxJson;
            this.callbackParameterName = callbackParameterName;
        }