Exemplo n.º 1
0
        private IObjectGraphTraversalStrategy CreateTraversalStrategy()
        {
            ITypeInspector typeDescriptor = new EmitTypeInspector(_typeResolver);

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

            typeDescriptor = new NamingConventionTypeInspector(typeDescriptor, _namingConvention);
            typeDescriptor = new YamlAttributesTypeInspector(typeDescriptor);

            if (IsOptionSet(SerializationOptions.Roundtrip))
            {
                return(new RoundtripObjectGraphTraversalStrategy(this, typeDescriptor, _typeResolver, 50));
            }
            else
            {
                return(new FullObjectGraphTraversalStrategy(this, typeDescriptor, _typeResolver, 50, _namingConvention));
            }
        }
        private IObjectGraphTraversalStrategy CreateTraversalStrategy()
        {
            ITypeInspector typeDescriptor = new EmitTypeInspector(typeResolver);
            if (IsOptionSet(SerializationOptions.Roundtrip))
            {
                typeDescriptor = new ReadableAndWritablePropertiesTypeInspector(typeDescriptor);
            }

            typeDescriptor = new NamingConventionTypeInspector(typeDescriptor, namingConvention);
            typeDescriptor = new YamlAttributesTypeInspector(typeDescriptor);

            if (IsOptionSet(SerializationOptions.Roundtrip))
            {
                return new RoundtripObjectGraphTraversalStrategy(this, typeDescriptor, typeResolver, 50);
            }
            else
            {
                return new FullObjectGraphTraversalStrategy(this, typeDescriptor, typeResolver, 50, namingConvention);
            }
        }