Exemple #1
0
        private string LoadJson()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("\"NAME\":\"" + NAME + "\"");
            sb.Append(",\"DISPLAY_NAME\":\"" + DISPLAY_NAME + "\"");
            sb.Append(",\"DESCRIPTION\":\"" + (DESCRIPTION == null ? "" : DESCRIPTION) + "\"");
            sb.Append(",\"DataType\":\"" + (DataType.Name.Equals("Nullable`1") ? (DataType.GetGenericTypeArguments()[0].Name + " (Nullable)") : DataType.IsCollectionOf <WSEntity>() ? (DataType.GetEntityType().Name + "[]") : DataType.Name) + "\"");
            sb.Append(",\"IsPrimitive\":" + (IsPrimitive).ToString().ToLower() + "");
            sb.Append(",\"IsEditable\":" + (IsPrimitive && func != null && func.IsAccessible(WRITE_ACCESS_MODE.ACCESS_LEVEL) && WRITE_ACCESS_MODE.ACCESS_LEVEL >= WSConstants.ACCESS_LEVEL.UPDATE).ToString().ToLower() + "");

            sb.Append("," + base.Json);

            sb.Append(",\"READ_ACCESS_MODE\":");
            sb.Append(READ_ACCESS_MODE.Json);
            sb.Append(",\"ALLOWED_VALUES\":[");
            if (ALLOWED_VALUES != null && ALLOWED_VALUES.Any())
            {
                sb.Append(ALLOWED_VALUES.Select(x => x.Json).Where(x => !string.IsNullOrEmpty(x)).Select(x => "{" + x + "}").Aggregate((a, b) => a + "," + b));
            }
            sb.Append("]");
            return(sb.ToString());
        }