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);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes an instance with the specific <paramref name="type"/> and
 /// <paramref name="owningRepository" />.
 /// </summary>
 /// <param name="type">the .NET type that the metadata is for</param>
 /// <param name="owningRepository">the repository creating this object</param>
 public TypeData(Type forType, TypeDataRepository owningRepository) : base(forType)
 {
     this.OwningRepository = owningRepository;
     this.Settings         = owningRepository.Config;
 }
Esempio n. 3
0
 public static ITypeData Create(Type forType, TypeDataRepository owningRepository)
 {
     return((ITypeData)typeof(TypeData <>).MakeGenericType(forType).GetConstructor(new [] { typeof(TypeDataRepository) }).Invoke(new [] { owningRepository }));
 }