internal DataStoreBinaryValueStream( IDataStoreBinaryValue value )
                : base(new MemoryStream())
            {
                Ensure.Debug(value, v => v.NotNull());

                this.binaryValue = value;

                if( this.binaryValue.Content.Count != 0 )
                {
                    this.BaseStream.Write(this.binaryValue.Content.Array, this.binaryValue.Content.Offset, this.binaryValue.Content.Count);
                    this.BaseStream.Position = 0;
                }
            }
            /// <summary>
            /// Called before the object is disposed of. Inheritors must call base.OnDisposing to be properly disposed.
            /// </summary>
            /// <param name="disposing">If set to <c>true</c>, the method was called by Dispose; otherwise by the destructor.</param>
            protected override void OnDisposing( bool disposing )
            {
                if( this.binaryValue.NotNullReference() )
                {
                    this.binaryValue.Content = new ArraySegment<byte>(((MemoryStream)this.BaseStream).ToArray());
                    this.binaryValue = null;
                }

                base.OnDisposing(disposing);
            }
            internal DataStoreBinaryValueWriter( IDataStoreBinaryValue value )
                : base(new MemoryStream())
            {
                Ensure.Debug(value, v => v.NotNull());

                this.binaryValue = value;
            }