예제 #1
0
        private ObjectDef ParseObject(XmlNode node)
        {
            var obj = new ObjectDef();

            obj.Name = node.SelectSingleNode("Name").InnerText;
            obj.Guid = node.SelectSingleNode("Guid").InnerText;
            var fields       = node.SelectSingleNode("Fields").SelectNodes("Field");
            var systemFields = node.SelectSingleNode("SystemFields").SelectNodes("SystemField");
            var fieldList    = new List <Field>();

            foreach (XmlNode field in fields)
            {
                var fieldDef = ParseField(field);
                if (fieldDef != null)
                {
                    fieldList.Add(fieldDef);
                }
            }
            foreach (XmlNode field in systemFields)
            {
                var fieldDef = ParseField(field, true);
                if (fieldDef != null)
                {
                    fieldList.Add(fieldDef);
                }
            }
            obj.Fields      = fieldList;
            obj.ObjectRules = ParseObjectRules(node)?.ToList() ?? new List <ObjectRule>();
            obj.Layouts     = ParseLayouts(node)?.ToList() ?? new List <Layout>();
            return(obj);
        }
예제 #2
0
        public ObjectDef ParseObject(XmlNode node)
        {
            var obj = new ObjectDef();

            obj.Name = node.SelectNodes("Name").Item(0).InnerText;
            obj.Guid = node.SelectNodes("Guid").Item(0).InnerText;
            var fields = node.SelectNodes("Fields")
                         .Item(0)
                         .SelectNodes("Field");
            var systemFields = node.SelectNodes("SystemFields")
                               .Item(0)
                               .SelectNodes("SystemField");
            var fieldList = new List <Field>();

            foreach (XmlNode field in fields)
            {
                var fieldDef = ParseField(field);
                if (fieldDef != null)
                {
                    fieldList.Add(fieldDef);
                }
            }
            foreach (XmlNode field in systemFields)
            {
                var fieldDef = ParseField(field, true);
                if (fieldDef != null)
                {
                    fieldList.Add(fieldDef);
                }
            }
            obj.Fields = fieldList;
            return(obj);
        }
예제 #3
0
 private static void GetProperties(ObjectDef obj, StringBuilder str)
 {
     foreach (var field in obj.Fields)
     {
         var parseString    = $"Guid.Parse({GetFieldGuidClass(obj)}.{field.Name})";
         var fieldTypeTuple = GetFieldType(field);
         str.Append($"\t\tpublic {fieldTypeTuple.Item1} {field.Name}");
         str.Append("{");
         str.Append($"get {{ return this.RDO[{parseString}].{fieldTypeTuple.Item2}; }}");
         str.Append($"set {{ this.RDO[{parseString}] = value; }}");
         str.Append("}");
         str.AppendLine();
     }
     return;
 }
예제 #4
0
 private static string GetFieldGuidClass(ObjectDef obj)
 {
     return($"{obj.Name}FieldGuids");
 }