Beispiel #1
0
        public void CreateRange <T>(params T[] items) where T : Model
        {
            Type    type = typeof(T);
            XmlNode root = GetTypeNodeItemsSection(type, document);

            foreach (T item in items)
            {
                XmlElement           xmlElement = document.CreateElement("item");
                List <PropertyValue> values     = ReflectionParser.GetProperties(item);

                SetXmlElementAttributes(xmlElement, values);

                root.AppendChild(xmlElement);
            }
        }
Beispiel #2
0
        public void UpdateRange <T>(params T[] items) where T : Model
        {
            Type    type = typeof(T);
            XmlNode root = GetTypeNodeItemsSection(type, document);

            foreach (T item in items)
            {
                List <PropertyValue> values = ReflectionParser.GetProperties(item);
                int     id       = item.Id;
                XmlNode itemNode = GetNodeById(id, root.ChildNodes);

                if (itemNode != null)
                {
                    UpdateXmlNode(itemNode, values);
                }
            }
        }