Esempio n. 1
0
        private IObjectGraphTraversalStrategy CreateTraversalStrategy()
        {
            ITypeInspector typeDescriptor = new ReadablePropertiesTypeInspector(typeResolver);

            if (IsOptionSet(SerializationOptions.Roundtrip))
            {
                typeDescriptor = new ReadableAndWritablePropertiesTypeInspector(typeDescriptor);
            }

            typeDescriptor = new NamingConventionTypeInspector(typeDescriptor, namingConvention);
            typeDescriptor = new YamlAttributesTypeInspector(typeDescriptor);
            if (IsOptionSet(SerializationOptions.DefaultToStaticType))
            {
                typeDescriptor = new CachedTypeInspector(typeDescriptor);
            }

            if (IsOptionSet(SerializationOptions.Roundtrip))
            {
                return(new RoundtripObjectGraphTraversalStrategy(this, typeDescriptor, typeResolver, 50));
            }
            else
            {
                return(new FullObjectGraphTraversalStrategy(this, typeDescriptor, typeResolver, 50, namingConvention));
            }
        }
Esempio n. 2
0
        private IObjectGraphTraversalStrategy CreateTraversalStrategy()
        {
            ITypeInspector innerTypeDescriptor = new ReadablePropertiesTypeInspector(this.typeResolver);

            if (this.IsOptionSet(SerializationOptions.Roundtrip))
            {
                innerTypeDescriptor = new ReadableAndWritablePropertiesTypeInspector(innerTypeDescriptor);
            }
            innerTypeDescriptor = new YamlAttributesTypeInspector(new YamlAttributeOverridesInspector(new NamingConventionTypeInspector(innerTypeDescriptor, this.namingConvention), this.overrides));
            if (this.IsOptionSet(SerializationOptions.DefaultToStaticType))
            {
                innerTypeDescriptor = new CachedTypeInspector(innerTypeDescriptor);
            }
            return(!this.IsOptionSet(SerializationOptions.Roundtrip) ? new FullObjectGraphTraversalStrategy(this, innerTypeDescriptor, this.typeResolver, 50, this.namingConvention) : new RoundtripObjectGraphTraversalStrategy(this, innerTypeDescriptor, this.typeResolver, 50));
        }