Exemplo n.º 1
0
        /// <summary>
        /// Bind the JBST to the provided data.
        /// </summary>
        /// <param name="jbstName"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string Bind(EcmaScriptIdentifier jbstName, object data)
        {
            StringWriter writer = new StringWriter();

            // render the JBST
            JbstBuildResult jbst = JbstBuildResult.FindJbst(jbstName);

            jbst.IsDebug = IsDebug;
            jbst.Write(writer, data);

            return(writer.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Bind the JBST to the provided data.
        /// </summary>
        /// <param name="jbstName"></param>
        /// <param name="dataName">named data to bind</param>
        /// <param name="dataItems">collection of data to emit</param>
        /// <returns></returns>
        public static string Bind(EcmaScriptIdentifier jbstName, EcmaScriptIdentifier dataName, IDictionary <string, object> dataItems)
        {
            StringWriter    writer = new StringWriter();
            JbstBuildResult jbst   = JbstBuildResult.FindJbst(jbstName);

            jbst.IsDebug = IsDebug;

            if (dataItems != null)
            {
                // render data block
                new DataBlockWriter(jbst.AutoMarkup, jbst.IsDebug).Write(writer, dataItems);
            }

            // render the JBST
            jbst.Write(writer, dataName);

            return(writer.ToString());
        }