private static string GetFormattedPostEntityImage(EntityImageCollection postImageCollection)
        {
            if (postImageCollection == null)
            {
                return(String.Empty);
            }

            return(postImageCollection?.Count > 0
                ? "[" + string.Join(", ", postImageCollection.Select(i => i.Key + ": [" + string.Join(", ", postImageCollection[i.Key].Attributes.Select(a => a.Key).ToArray()) + "}").ToArray()) + "]"
                : String.Empty);
        }
        private T GetValue <T> (string attribute, Entity target, EntityImageCollection preImages)
        {
            if (string.IsNullOrEmpty(attribute))
            {
                return(default(T));
            }

            return(target.Contains(attribute)
                ? target.GetAttributeValue <T>(attribute)
                : preImages.Select(p => p.Value.GetAttributeValue <T>(config.Value.ParentLookupName)).FirstOrDefault());
        }
예제 #3
0
        /// <summary>
        /// Iterates and displays the entity images in the entity image collection.
        /// </summary>
        /// <param name="images">The images.</param>
        /// <param name="name">The name.</param>
        /// <param name="info">Optional arguments.</param>
        public static string ToStringDebug(this EntityImageCollection images, string name, StringDebugInfo info = null)
        {
            info = info ?? StringDebugInfo.Default;
            if (images == null)
            {
                return(info.Indent + name + ": null");
            }


            if (images.Count == 1)
            {
                var kvp = images.First();
                var id  = kvp.Value?.Id == Guid.Empty
                    ? string.Empty
                    : "_" + kvp.Value?.LogicalName + "_" + kvp.Value?.Id.ToString("N");
                return(info.Indent + name + id + ": " + images.Values.First().ToStringAttributes(info).TrimStart());
            }

            return(Wrap(name + ": {",
                        images.Select(v => v.Key + ": " + v.Value.ToStringDebug(info).TrimStart()),
                        "}",
                        info.WithNoTab(),
                        string.Empty));
        }