コード例 #1
0
        private Base ReadObject(Base parent, XmlItem item, bool readChildren, FRReader reader)
        {
            string objName = item.Name;

            // try to find the object in the dictionary
            Base obj = preparedPages.Dictionary.GetObject(objName);

            // object not found, objName is type name
            if (obj == null)
            {
                Type type = RegisteredObjects.FindType(objName);
                if (type == null)
                {
                    return(null);
                }
                obj = Activator.CreateInstance(type) as Base;
            }
            obj.SetRunning(true);

            // read object's properties
            if (!item.IsNullOrEmptyProps())
            {
                // since the BlobStore is shared resource, lock it to avoid problems with multi-thread access.
                // this may happen in the html export that uses several threads to export one report.
                lock (reader.BlobStore)
                {
                    reader.Read(obj, item);
                }
            }

            if (readChildren)
            {
                for (int i = 0; i < item.Count; i++)
                {
                    ReadObject(obj, item[i], true, reader);
                }
            }

            obj.Parent = parent;
            return(obj);
        }