Beispiel #1
0
        public SerializationContext()
        {
            _outputTypeComment = true;
            _outputTypeInformation = true;
            _referenceWritingType = ReferenceOption.ErrorCircularReferences;

            _typeAliases = new TypeAliasCollection();

            // collections
            _collectionHandlers = new List<CollectionHandler>();
            _collectionHandlers.Add(new GenericCollectionHandler());
            _collectionHandlers.Add(new ArrayHandler());
            _collectionHandlers.Add(new ListHandler());
            _collectionHandlers.Add(new StackHandler());
            _collectionHandlers.Add(new GenericStackHandler());
            _collectionHandlers.Add(new CollectionConstructorHandler());

            // type handlers
            _typeHandlerFactory = new TypeDataRepository(this);
            _parameters = new Hashtable();

            // type conversion
            _typeHandlerFactory.RegisterTypeConverter(typeof(System.Collections.BitArray), new BitArrayConverter());

            this.expressionHandlers = new ExpressionHandlerCollection(this);
            this.defaultValues = new DefaultValueCollection();
        }
Beispiel #2
0
 /// <summary>
 /// Initializes an instance with the specific <paramref name="type"/> and
 /// <paramref name="context" />.
 /// </summary>
 /// <param name="type">the .NET type that the metadata is for</param>
 /// <param name="context">the serializer context</param>
 public TypeData(Type type, TypeDataRepository owningRepository)
     : base(type)
 {
     this._owningRepository = owningRepository;
     this.config = owningRepository.Config;
 }