예제 #1
0
        internal SerializationContext(
            SerializerRepository serializers, PackerCompatibilityOptions packerCompatibilityOptions)
        {
            Contract.Requires(serializers != null);

            this._compatibilityOptions =
                new SerializationCompatibilityOptions()
            {
                PackerCompatibilityOptions =
                    packerCompatibilityOptions
            };
            this._serializers            = serializers;
            this._typeLock               = new HashSet <Type>();
            this._defaultCollectionTypes = new DefaultConcreteTypeRepository();
        }
        internal SerializationContext(
            SerializerRepository serializers, PackerCompatibilityOptions packerCompatibilityOptions)
        {
            this._compatibilityOptions =
                new SerializationCompatibilityOptions
            {
                PackerCompatibilityOptions =
                    packerCompatibilityOptions
            };
            this._serializers = serializers;
#if !XAMIOS && !XAMDROID && !UNITY
#if SILVERLIGHT || NETFX_35
            this._typeLock = new Dictionary <Type, object>();
#else
            this._typeLock = new ConcurrentDictionary <Type, object>();
#endif // SILVERLIGHT || NETFX_35
#endif // !XAMIOS && !XAMDROID && !UNITY
            this._defaultCollectionTypes = new DefaultConcreteTypeRepository();
        }
        internal SerializationContext(
            SerializerRepository serializers, PackerCompatibilityOptions packerCompatibilityOptions)
        {
            Contract.Requires(serializers != null);

            this._compatibilityOptions =
                new SerializationCompatibilityOptions()
            {
                PackerCompatibilityOptions =
                    packerCompatibilityOptions
            };
            this._serializers = serializers;
#if SILVERLIGHT || NETFX_35
            this._typeLock = new HashSet <Type>();
#else
            this._typeLock = new ConcurrentDictionary <Type, object>();
#endif
            this._defaultCollectionTypes = new DefaultConcreteTypeRepository();
        }
예제 #4
0
		/// <summary>
		///		Initializes a new instance of the <see cref="SerializationContext"/> class with copy of <see cref="SerializerRepository.GetDefault()"/> for specified <see cref="PackerCompatibilityOptions"/>.
		/// </summary>
		/// <param name="packerCompatibilityOptions"><see cref="PackerCompatibilityOptions"/> which will be used on built-in serializers.</param>
		public SerializationContext( PackerCompatibilityOptions packerCompatibilityOptions )
		{
			this._compatibilityOptions =
				new SerializationCompatibilityOptions
				{
					PackerCompatibilityOptions =
						packerCompatibilityOptions
				};

			this._serializers = new SerializerRepository( SerializerRepository.GetDefault( this ) );

#if SILVERLIGHT || NETFX_35 || UNITY
			this._typeLock = new Dictionary<Type, object>();
#else
			this._typeLock = new ConcurrentDictionary<Type, object>();
#endif // SILVERLIGHT || NETFX_35 || UNITY
			this._generationLock = new object();
			this._defaultCollectionTypes = new DefaultConcreteTypeRepository();
			this._serializerGeneratorOptions = new SerializerOptions();
		}
예제 #5
0
		/// <summary>
		///		Initializes a new instance of the <see cref="SerializationContext"/> class with copy of <see cref="SerializerRepository.GetDefault()"/> for specified <see cref="PackerCompatibilityOptions"/>.
		/// </summary>
		/// <param name="packerCompatibilityOptions"><see cref="PackerCompatibilityOptions"/> which will be used on built-in serializers.</param>
		public SerializationContext( PackerCompatibilityOptions packerCompatibilityOptions )
		{
			this._compatibilityOptions =
				new SerializationCompatibilityOptions
				{
					PackerCompatibilityOptions =
						packerCompatibilityOptions
				};

			this._serializers = new SerializerRepository( SerializerRepository.GetDefault( this ) );

#if !FEATURE_CONCURRENT
			this._typeLock = new Dictionary<Type, object>();
#else
			this._typeLock = new ConcurrentDictionary<Type, object>();
#endif // !FEATURE_CONCURRENT
			this._generationLock = new object();
			this._defaultCollectionTypes = new DefaultConcreteTypeRepository();
			this._serializerGeneratorOptions = new SerializerOptions();
			this._dictionarySerializationOptions = new DictionarySerlaizationOptions();
			this._enumSerializationOptions = new EnumSerializationOptions();
		}