示例#1
0
 internal XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializer serializer, DataContract rootTypeDataContract)
     : base(serializer, serializer.MaxItemsInObjectGraph, new StreamingContext(StreamingContextStates.All), serializer.IgnoreExtensionDataObject)
 {
     _emitXsiType = serializer.EmitTypeInformation;
     this.rootTypeDataContract    = rootTypeDataContract;
     this.serializerKnownTypeList = serializer.knownTypeList;
     this.serializeReadOnlyTypes  = serializer.SerializeReadOnlyTypes;
     _useSimpleDictionaryFormat   = serializer.UseSimpleDictionaryFormat;
 }
 internal XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract)
     : base(serializer, serializer.MaxItemsInObjectGraph, new StreamingContext(), false)
 {
     _emitXsiType = serializer.EmitTypeInformation;
     this.rootTypeDataContract = rootTypeDataContract;
     this.serializerKnownTypeList = serializer.knownTypeList;
     this.serializeReadOnlyTypes = serializer.SerializeReadOnlyTypes;
     _useSimpleDictionaryFormat = serializer.UseSimpleDictionaryFormat;
 }
示例#3
0
 internal XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract)
     : base(serializer, serializer.MaxItemsInObjectGraph, default(StreamingContext), false)
 {
     _emitXsiType = serializer.EmitTypeInformation;
     this.rootTypeDataContract    = rootTypeDataContract;
     this.serializerKnownTypeList = serializer.knownTypeList;
     this.serializeReadOnlyTypes  = serializer.SerializeReadOnlyTypes;
     _useSimpleDictionaryFormat   = serializer.UseSimpleDictionaryFormat;
 }
        internal DataContractJsonSerializerImpl(Type type,
                                                IEnumerable <Type> knownTypes,
                                                int maxItemsInObjectGraph,
                                                bool ignoreExtensionDataObject,
                                                bool alwaysEmitTypeInformation)
        {
            EmitTypeInformation emitTypeInformation = alwaysEmitTypeInformation ? EmitTypeInformation.Always : EmitTypeInformation.AsNeeded;

            Initialize(type, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, emitTypeInformation, false, null, false);
        }
        public DataContractJsonSerializer(Type type, XmlDictionaryString rootName,
                                          IEnumerable <Type> knownTypes,
                                          int maxItemsInObjectGraph,
                                          bool ignoreExtensionDataObject,
                                          IDataContractSurrogate dataContractSurrogate,
                                          bool alwaysEmitTypeInformation)
        {
            EmitTypeInformation emitTypeInformation = alwaysEmitTypeInformation ? EmitTypeInformation.Always : EmitTypeInformation.AsNeeded;

            Initialize(type, rootName, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, dataContractSurrogate, emitTypeInformation, false, null, false);
        }
 public XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializer serializer, DataContract rootTypeDataContract)
     : base(serializer,
     serializer.MaxItemsInObjectGraph,
     new StreamingContext(StreamingContextStates.All),
     serializer.IgnoreExtensionDataObject)
 {
     this.emitXsiType = serializer.EmitTypeInformation;
     this.rootTypeDataContract = rootTypeDataContract;
     this.serializerKnownTypeList = serializer.knownTypeList;
     this.dataContractSurrogate = serializer.DataContractSurrogate;
     this.serializeReadOnlyTypes = serializer.SerializeReadOnlyTypes;
     this.useSimpleDictionaryFormat = serializer.UseSimpleDictionaryFormat;
 }
 private void Initialize(Type type,
                         XmlDictionaryString rootName,
                         IEnumerable <Type> knownTypes,
                         int maxItemsInObjectGraph,
                         bool ignoreExtensionDataObject,
                         EmitTypeInformation emitTypeInformation,
                         bool serializeReadOnlyTypes,
                         DateTimeFormat dateTimeFormat,
                         bool useSimpleDictionaryFormat)
 {
     Initialize(type, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, emitTypeInformation, serializeReadOnlyTypes, dateTimeFormat, useSimpleDictionaryFormat);
     _rootName = ConvertXmlNameToJsonName(rootName);
     _rootNameRequiresMapping = CheckIfJsonNameRequiresMapping(_rootName);
 }
        void Initialize(Type type,
                        IEnumerable <Type> knownTypes,
                        int maxItemsInObjectGraph,
                        bool ignoreExtensionDataObject,
                        IDataContractSurrogate dataContractSurrogate,
                        EmitTypeInformation emitTypeInformation,
                        bool serializeReadOnlyTypes,
                        DateTimeFormat dateTimeFormat,
                        bool useSimpleDictionaryFormat)
        {
            CheckNull(type, "type");
            this.rootType = type;

            if (knownTypes != null)
            {
                this.knownTypeList = new List <Type>();
                foreach (Type knownType in knownTypes)
                {
                    this.knownTypeList.Add(knownType);
                    if (knownType != null)
                    {
                        AddCollectionItemTypeToKnownTypes(knownType);
                    }
                }
            }

            if (maxItemsInObjectGraph < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxItemsInObjectGraph", System.Runtime.Serialization.SR.GetString(System.Runtime.Serialization.SR.ValueMustBeNonNegative)));
            }
            this.maxItemsInObjectGraph     = maxItemsInObjectGraph;
            this.ignoreExtensionDataObject = ignoreExtensionDataObject;
            this.dataContractSurrogate     = dataContractSurrogate;
            this.emitTypeInformation       = emitTypeInformation;
            this.serializeReadOnlyTypes    = serializeReadOnlyTypes;
            this.dateTimeFormat            = dateTimeFormat;
            this.useSimpleDictionaryFormat = useSimpleDictionaryFormat;
        }
示例#9
0
        private void Initialize(Type type,
                                IEnumerable <Type>?knownTypes,
                                int maxItemsInObjectGraph,
                                bool ignoreExtensionDataObject,
                                EmitTypeInformation emitTypeInformation,
                                bool serializeReadOnlyTypes,
                                DateTimeFormat?dateTimeFormat,
                                bool useSimpleDictionaryFormat)
        {
            ArgumentNullException.ThrowIfNull(type);

            _rootType = type;

            if (knownTypes != null)
            {
                this.knownTypeList = new List <Type>();
                foreach (Type knownType in knownTypes)
                {
                    this.knownTypeList.Add(knownType);
                    if (knownType != null)
                    {
                        AddCollectionItemTypeToKnownTypes(knownType);
                    }
                }
            }

            if (maxItemsInObjectGraph < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxItemsInObjectGraph), SR.ValueMustBeNonNegative);
            }
            _maxItemsInObjectGraph     = maxItemsInObjectGraph;
            _ignoreExtensionDataObject = ignoreExtensionDataObject;
            _emitTypeInformation       = emitTypeInformation;
            _serializeReadOnlyTypes    = serializeReadOnlyTypes;
            _dateTimeFormat            = dateTimeFormat;
            _useSimpleDictionaryFormat = useSimpleDictionaryFormat;
        }
        private void Initialize(Type type,
                                IEnumerable <Type> knownTypes,
                                int maxItemsInObjectGraph,
                                bool ignoreExtensionDataObject,
                                EmitTypeInformation emitTypeInformation,
                                bool serializeReadOnlyTypes,
                                DateTimeFormat dateTimeFormat,
                                bool useSimpleDictionaryFormat)
        {
            CheckNull(type, "type");
            _rootType = type;

            if (knownTypes != null)
            {
                this.knownTypeList = new List <Type>();
                foreach (Type knownType in knownTypes)
                {
                    this.knownTypeList.Add(knownType);
                    if (knownType != null)
                    {
                        AddCollectionItemTypeToKnownTypes(knownType);
                    }
                }
            }

            if (maxItemsInObjectGraph < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxItemsInObjectGraph", SR.Format(SR.ValueMustBeNonNegative)));
            }
            _maxItemsInObjectGraph     = maxItemsInObjectGraph;
            _ignoreExtensionDataObject = ignoreExtensionDataObject;
            _emitTypeInformation       = emitTypeInformation;
            _serializeReadOnlyTypes    = serializeReadOnlyTypes;
            _dateTimeFormat            = dateTimeFormat;
            _useSimpleDictionaryFormat = useSimpleDictionaryFormat;
        }
 private void Initialize(Type type,
     XmlDictionaryString rootName,
     IEnumerable<Type> knownTypes,
     int maxItemsInObjectGraph,
     bool ignoreExtensionDataObject,
     EmitTypeInformation emitTypeInformation,
     bool serializeReadOnlyTypes,
     DateTimeFormat dateTimeFormat,
     bool useSimpleDictionaryFormat)
 {
     Initialize(type, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, emitTypeInformation, serializeReadOnlyTypes, dateTimeFormat, useSimpleDictionaryFormat);
     _rootName = ConvertXmlNameToJsonName(rootName);
     _rootNameRequiresMapping = CheckIfJsonNameRequiresMapping(_rootName);
 }
        private void Initialize(Type type,
            IEnumerable<Type> knownTypes,
            int maxItemsInObjectGraph,
            bool ignoreExtensionDataObject,
            EmitTypeInformation emitTypeInformation,
            bool serializeReadOnlyTypes,
            DateTimeFormat dateTimeFormat,
            bool useSimpleDictionaryFormat)
        {
            CheckNull(type, "type");
            _rootType = type;

            if (knownTypes != null)
            {
                this.knownTypeList = new List<Type>();
                foreach (Type knownType in knownTypes)
                {
                    this.knownTypeList.Add(knownType);
                    if (knownType != null)
                    {
                        AddCollectionItemTypeToKnownTypes(knownType);
                    }
                }
            }

            if (maxItemsInObjectGraph < 0)
            {
                throw new ArgumentOutOfRangeException("maxItemsInObjectGraph", SR.ValueMustBeNonNegative);
            }
            _maxItemsInObjectGraph = maxItemsInObjectGraph;
            _ignoreExtensionDataObject = ignoreExtensionDataObject;
            _emitTypeInformation = emitTypeInformation;
            _serializeReadOnlyTypes = serializeReadOnlyTypes;
            _dateTimeFormat = dateTimeFormat;
            _useSimpleDictionaryFormat = useSimpleDictionaryFormat;
        }
        void Initialize(Type type,
            IEnumerable<Type> knownTypes,
            int maxItemsInObjectGraph,
            bool ignoreExtensionDataObject,
            IDataContractSurrogate dataContractSurrogate,
            EmitTypeInformation emitTypeInformation,
            bool serializeReadOnlyTypes,
            DateTimeFormat dateTimeFormat,
            bool useSimpleDictionaryFormat)
        {
            CheckNull(type, "type");
            this.rootType = type;

            if (knownTypes != null)
            {
                this.knownTypeList = new List<Type>();
                foreach (Type knownType in knownTypes)
                {
                    this.knownTypeList.Add(knownType);
                    if (knownType != null)
                    {
                        AddCollectionItemTypeToKnownTypes(knownType);
                    }
                }
            }

            if (maxItemsInObjectGraph < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxItemsInObjectGraph", System.Runtime.Serialization.SR.GetString(System.Runtime.Serialization.SR.ValueMustBeNonNegative)));
            }
            this.maxItemsInObjectGraph = maxItemsInObjectGraph;
            this.ignoreExtensionDataObject = ignoreExtensionDataObject;
            this.dataContractSurrogate = dataContractSurrogate;
            this.emitTypeInformation = emitTypeInformation;
            this.serializeReadOnlyTypes = serializeReadOnlyTypes;
            this.dateTimeFormat = dateTimeFormat;
            this.useSimpleDictionaryFormat = useSimpleDictionaryFormat;
        }