public override void Compile() { base.Compile(); var cs = new List <DefBeanBase>(); if (Children != null) { CollectHierarchyNotAbstractChildren(cs); } HierarchyNotAbstractChildren = cs; var ids = new HashSet <int>(); foreach (var c in cs) { if (c.Id <= 0) { throw new Exception($"bean:'{FullName}' is child of dynamic type. beanid:{Id} can't less then 0!"); } if (!ids.Add(c.Id)) { throw new Exception($"bean:'{c.FullName}' beanid:{c.Id} duplicate!"); } } DefFieldBase.CompileFields(this, HierarchyFields, IsSerializeCompatible); }
public bool TryGetField(string index, out DefFieldBase field, out int fieldIndexId) { for (int i = 0; i < HierarchyFields.Count; i++) { if (HierarchyFields[i].Name == index) { field = HierarchyFields[i]; fieldIndexId = i; return(true); } } field = null; fieldIndexId = 0; return(false); }