Ejemplo n.º 1
0
        public static DbTagsAndAttributes DatabaseFromObject(object startingTag)
        {
            HelperDbTagsAndAttributes tagsAndAttributes = new HelperDbTagsAndAttributes();

            tagsAndAttributes.ParseObject(startingTag);

            return(tagsAndAttributes.TagsAndAttributes);
        }
Ejemplo n.º 2
0
        public static DbTagsAndAttributes DatabaseFromElement(Element element)
        {
            HelperDbTagsAndAttributes tagsAndAttributes = new HelperDbTagsAndAttributes();

            tagsAndAttributes.ParseElement(element);

            return(tagsAndAttributes.TagsAndAttributes);
        }
Ejemplo n.º 3
0
        public static Element ElementFromDatabase(DbTagsAndAttributes tagsAndAttributes)
        {
            var rootElementQuery =
                from tag in tagsAndAttributes.Tags
                where tag.ParentId is null
                select tag;

            var rootTag = rootElementQuery.First();

            // database contains no root element or is empty
            if (rootTag is null)
            {
                return(new Element());
            }

            var helper = new HelperDbTagsAndAttributes(tagsAndAttributes);

            return(helper.ElementFromDatabaseTag(rootTag));
        }