Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SerializerSettings" /> class.
        /// </summary>
        public SerializerSettings(IYamlSchema schema)
        {
            PreferredIndent            = 2;
            IndentLess                 = false;
            EmitAlias                  = true;
            EmitTags                   = true;
            AllowErrors                = false;
            ResetAlias                 = true;
            SortKeyForMapping          = true;
            EmitJsonComptible          = false;
            EmitCapacityForList        = false;
            SpecialCollectionMember    = "~Items";
            LimitPrimitiveFlowSequence = 0;
            DefaultStyle               = YamlStyle.Block;
            this.schema                = schema ?? new CoreSchema();
            AssemblyRegistry           = new AssemblyRegistry(Schema);
            attributeRegistry          = new AttributeRegistry();
            ObjectFactory              = new DefaultObjectFactory();
            ObjectSerializerBackend    = new DefaultObjectSerializerBackend();
            ComparerForKeySorting      = new DefaultKeyComparer();
            NamingConvention           = new DefaultNamingConvention();

            // Register default mapping for map and seq
            AssemblyRegistry.RegisterTagMapping("!!map", typeof(IDictionary <object, object>), false);
            AssemblyRegistry.RegisterTagMapping("!!seq", typeof(IList <object>), false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SerializerSettings" /> class.
        /// </summary>
        public SerializerSettings(IYamlSchema schema)
        {
            PreferredIndent = 2;
            IndentLess = false;
            EmitAlias = true;
            EmitTags = true;
            SortKeyForMapping = true;
            EmitJsonComptible = false;
            EmitCapacityForList = false;
            SpecialCollectionMember = "~Items";
            LimitPrimitiveFlowSequence = 0;
            DefaultStyle = YamlStyle.Block;
            this.schema = schema ?? new CoreSchema();
            AssemblyRegistry = new AssemblyRegistry(Schema);
            attributeRegistry = new AttributeRegistry();
            ObjectFactory = new DefaultObjectFactory();
            ObjectSerializerBackend = new DefaultObjectSerializerBackend();
            ComparerForKeySorting = new DefaultKeyComparer();
            NamingConvention = new DefaultNamingConvention();

            // Register default mapping for map and seq
            AssemblyRegistry.RegisterTagMapping("!!map", typeof(IDictionary<object, object>));
            AssemblyRegistry.RegisterTagMapping("!!seq", typeof(IList<object>));
        }