/// <summary>
 /// Initializes a new instance of the <see cref="DataStoreNodeWriter"/> class.
 /// </summary>
 /// <param name="maxLength">The maximum number of characters or bytes to read; or <c>-1</c> to read them all.</param>
 public DataStoreNodeWriter( int maxLength = -1 )
 {
     this.root = null;
     this.parents = new List<IDataStoreObject>();
     this.valueSerializer = new DataStoreValueSerializer(maxLength);
     this.objectSerializer = new DataStoreObjectSerializer(this.valueSerializer);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataStoreNodeWriter"/> class.
        /// </summary>
        /// <param name="valueSerializer">The <see cref="DataStoreValueSerializer"/> to use.</param>
        /// <param name="objectSerializer">The <see cref="DataStoreObjectSerializer"/> to use.</param>
        public DataStoreNodeWriter( DataStoreValueSerializer valueSerializer, DataStoreObjectSerializer objectSerializer )
        {
            Ensure.That(valueSerializer).NotNull();
            Ensure.That(objectSerializer).NotNull();

            this.root = null;
            this.parents = new List<IDataStoreObject>();
            this.valueSerializer = valueSerializer;
            this.objectSerializer = objectSerializer;
        }
        internal static Mapping[] GetMappings()
        {
            var valueSerializer = new DataStoreValueSerializer(maxLength: -1);
            var objectSerializer = new DataStoreObjectSerializer(valueSerializer);

            return new Mapping[]
            {
                Map<IDataStoreValueSerializer<IDataStoreValue>>.To(() => valueSerializer).AsTransient(),
                Map<IDataStoreValueDeserializer<IDataStoreValue>>.To(() => valueSerializer).AsTransient(),
                Map<IDataStoreObjectSerializer<IDataStoreObject>>.To(() => objectSerializer).AsTransient(),
                Map<IDataStoreObjectDeserializer<IDataStoreObject>>.To(() => objectSerializer).AsTransient(),
            };
        }