Exemple #1
0
        public ModelBase Deserialize(XElement element)
        {
            DataModel model = new DataModel()
            {
                Name      = XmlLinqHelper.GetAttributeValue(element, "name", string.Empty),
                TableName = XmlLinqHelper.GetAttributeValue(element, "tablename", string.Empty)
            };

            foreach (XElement pe in element.Elements("property"))
            {
                IDataModelSerilizer serializer = new DataPropertySerializer();
                DataProperty        property   = serializer.Deserialize(pe) as DataProperty;
                if (property != null)
                {
                    property.Model = model;
                }
                model.Properties.Add(property);
            }

            foreach (XElement fe in element.Descendants("foreignmodel"))
            {
                IDataModelSerilizer serializer = new ForeignModelSerializer();
                ForeignModel        fm         = serializer.Deserialize(fe) as ForeignModel;
                if (fm != null)
                {
                    fm.ParentModel = model;
                }

                model.ForeignModels.Add(fm);
            }

            return(model);
        }
        public ModelBase Deserialize(XElement element)
        {
            ForeignModel model = new ForeignModel()
            {
                Name            = XmlLinqHelper.GetAttributeValue(element, "name", string.Empty),
                PropertyPrimary = XmlLinqHelper.GetAttributeValue(element, "propertyprimary", string.Empty),
                ForeignKey      = XmlLinqHelper.GetAttributeValue(element, "foreignkey", string.Empty),
                InnerSort       = XmlLinqHelper.GetAttributeValue(element, "innersort", 0)
            };

            return(model);
        }