/// <summary>
 /// This method is implemented by the fragment content and will be used to merge any
 /// changes back in to the root content.
 /// </summary>
 /// <param name="baseContent">The base content to merge in to.</param>
 public virtual void MergeContent(IXimuraContent baseContent)
 {
     throw new NotImplementedException("MergeContent is not implemented.");
 }
 /// <summary>
 /// This method is implemented by the fragment content and will be used to
 /// delete the root content.
 /// </summary>
 /// <param name="baseContent">The base content to merge in to.</param>
 public virtual void DeleteBaseContent(IXimuraContent baseContent)
 {
     //throw new NotImplementedException();
 }
 /// <summary>
 /// This method is used to set any specific header properties based on the entity type.
 /// </summary>
 /// <param name="entity">The entity being serialized.</param>
 protected virtual void SetContentHeaderProperties(IXimuraContent entity)
 {
     IXimuraContentEntityFragment cef = entity as IXimuraContentEntityFragment;
     if (cef != null)
         this.SupportsBaseType = cef.SupportsFragmentBaseType();
 }
        /// <summary>
        /// This method writes the content details from the serialization info in 
        /// to the stream.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="info">The serialization info.</param>
        protected virtual void ContentDetailsWrite(IXimuraContent entity, SerializationInfo info)
        {
            Guid cid = (Guid)info.GetValue("cid", typeof(Guid));
            Guid vid = (Guid)info.GetValue("vid", typeof(Guid));
            Guid tid = (Guid)info.GetValue("tid", typeof(Guid));
            rwHelper.Write(tid);
            rwHelper.Write(cid);
            rwHelper.Write(vid);

            if (WriteDate)
                rwHelper.Write(DateTime.UtcNow);

            mHeaderObjectName = entity.GetType().AssemblyQualifiedName;
            rwHelper.Write(mHeaderObjectName);

            if (SupportsBaseType)
            {
                IXimuraContentEntityFragment cef = entity as IXimuraContentEntityFragment;
                rwHelper.Write(cef.FragmentBaseType() == null ? "" : cef.FragmentBaseType().AssemblyQualifiedName);
            }
        }
        /// <summary>
        /// This method outputs the header for the stream.
        /// </summary>
        /// <param name="outStream">The stream to write to.</param>
        /// <param name="entity">The entity specified.</param>
        /// <param name="info">The SerializationInfo object.</param>
        public void Output(Stream outStream, IXimuraContent entity, SerializationInfo info)
        {
            if (outStream == null)
                throw new ArgumentNullException("Stream cannot be null.");
            if (info == null)
                throw new ArgumentNullException("SerializationInfo cannot be null.");
            if (entity == null)
                throw new ContentFormatterCapabilitiesException("The ContentFormatterCapabilities header has not been initialized.");

            //Set the stream for the helper.
            rwHelper.BaseStream = outStream;

            SetContentHeaderProperties(entity);

            //Write the header.
            HeaderWrite();
            //Write the capabilities.
            ContentDetailsWrite(entity, info);
        }