Exemple #1
0
        private static string ToString(ITransientObject value, IGraph graph, bool firstLevelObjectEmitted,
                                       IDictionary <string, IObject> nameToObject, IGraphProcessingEnvironment procEnv)
        {
            StringBuilder sb = new StringBuilder();
            string        transientObjectType = value.Type.PackagePrefixedName;

            sb.Append(transientObjectType);
            if (procEnv != null || !firstLevelObjectEmitted)
            {
                sb.Append("{");
            }
            bool first = true;

            if (procEnv != null)
            {
                sb.Append("&:" + procEnv.GetUniqueId(value));
                first = false;
            }
            if (!firstLevelObjectEmitted)
            {
                foreach (AttributeType attrType in value.Type.AttributeTypes)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        sb.Append(",");
                    }
                    sb.Append(attrType.Name);
                    sb.Append(":");
                    sb.Append(EmitHelper.ToStringAutomatic(value.GetAttribute(attrType.Name), graph, true,
                                                           nameToObject, procEnv));
                }
            }
            if (procEnv != null || !firstLevelObjectEmitted)
            {
                sb.Append("}");
            }
            return(sb.ToString());
        }