예제 #1
0
        /// <summary>
        /// Returns the Json string as expected by the Google Api
        /// </summary>
        /// <returns></returns>
        internal void GetJson(StreamWriter sw)
        {
            sw.Write("{");

            sw.AppendIfNotNullOrEmpty("type", this.ColumnType.ToString().ToLower(CultureInfo.InvariantCulture));

            if (this.Id != null)
            {
                sw.Write(",");
                sw.AppendIfNotNullOrEmpty("id", this.Id);
            }

            if (this.Label != null)
            {
                sw.Write(",");
                sw.AppendIfNotNullOrEmpty("label", this.Label);
            }

            if (this.Pattern != null)
            {
                sw.Write(",");
                sw.AppendIfNotNullOrEmpty("pattern", this.Pattern);
            }

            List <Property> propertyList = this.PropertyMap.ToList();

            if (!string.IsNullOrEmpty(this.Role))
            {
                propertyList.Add(new Property("role", this.Role));
            }

            Helper.JsonizeProperties(sw, propertyList);

            sw.Write("}");
        }