Beispiel #1
0
        /// <summary>
        /// Serializes data document
        /// </summary>
        public static void Serialize(BixWriter writer, TypedDoc root, BixContext ctx = null)
        {
            if (!writer.IsAssigned)
            {
                throw new BixException(StringConsts.ARGUMENT_ERROR + "{0}.!Assigned".Args(nameof(BixWriter)));
            }

            if (ctx == null)
            {
                ctx = BixContext.ObtainDefault();
            }

            //1 Header
            if (ctx.HasHeader)
            {
                Writer.WriteHeader(writer, ctx);
            }

            //2 Payload
            Writer.WriteDoc(writer, root, ctx, isRoot: true);

            ctx.DisposeDefault();
        }
Beispiel #2
0
 /// <summary>
 /// Serializes typed data document into BixWriter
 /// </summary>
 public abstract void Serialize(BixWriter writer, TypedDoc doc, BixContext ctx);