Esempio n. 1
0
        // Read the properties in a property context
        // T is the type of the object to be populated
        // Property getters must be supplied to map property Ids to members of T
        // The returned value is the subnode tree, if any, related to the contents of the properties
        //
        // First form takes a node ID for a node in the main node tree
        public BTree <Node> ReadProperties <T>(FileStream fs, NID nid, PropertyGetters <T> g, T target)
        {
            BTree <Node> subNodeTree;
            var          rn = ndb.LookupNodeAndReadItsSubNodeBtree(fs, nid, out subNodeTree);

            ReadPropertiesInternal <T>(fs, subNodeTree, rn.DataBid, g, target);

            return(subNodeTree);
        }
Esempio n. 2
0
        public List <Property> ReadAttachmentProperties(Attachment a)
        {
            using (var fs = ndb.GetReadStream())
            {
                BTree <Node> subNodeTreeMessage = a.subNodeTreeProperties;

                if (subNodeTreeMessage == null)
                {
                    // No subNodeTree given: assume we can look it up in the main tree
                    ndb.LookupNodeAndReadItsSubNodeBtree(fs, a.Parent.Nid, out subNodeTreeMessage);
                }

                // Read all non-content properties
                // Convert to list so that we can dispose the file access
                return(new List <Property>(ltp.ReadAllProperties(fs, subNodeTreeMessage, a.Nid, attachmentContentExclusions, true)));
            }
        }