Example #1
0
        /// /// /// /// /// /// /// /// ///
        /// /// /// /// /// /// /// /// ///
        /// /// /// /// /// /// /// /// ///
        /// /// /// /// /// /// /// /// ///

        protected static internal ODObject getObjectFromEntry(string collection, XmlElement entry)
        {
            ODObject result = new ODObject();

            result._data           = ODBase.GetEntryFields(entry);
            result._binaryDataLink = ODBase.GetDataLink(entry);
            result._Collection     = collection;
            result.Guid            = result["Id"].ToString();
            return(result);
        }
Example #2
0
        /// <summary>
        /// Finds and initializes object. Throws exception if not found.
        /// </summary>
        public ODObject(ODBase odb, string Collection, string Guid)
        {
            this.Guid        = Guid;
            this._Collection = Collection;

            this._data = null;

            List <XmlElement> elements = odb.GetPage(odb.GetCollectionPageUrl(Collection) + "Collection(guid'" + Guid + "')");

            if (elements.Count == 1)
            {
                this._data = ODBase.GetEntryFields(elements[0]);
            }

            if (this._data == null || this._data.Count == 0)
            {
                throw new Exception(Collection + "Collection(guid'" + Guid + "') not found");
            }

            this._binaryDataLink = ODBase.GetDataLink(elements[0]);
        }