/// <summary> /// Export entity schema for client sync. /// </summary> /// <param name="schema"></param> /// <returns></returns> public static string ExportSync(SchemaTable schema) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("g__schema[\"{0}\"] = ", schema.EntityName); sb.AppendLine("{"); var columns = schema.GetColumns(); int index = 0; int endIndex = columns.Count - 1; int depth = 1; foreach (var col in columns) { bool isEnd = index == endIndex; if (col.HasChild) { WriteChildSchema(sb, col, depth + 1, isEnd); } else { WriteColumnSchema(sb, col, depth, isEnd); } index++; } sb.AppendLine("}"); return(sb.ToString()); }