コード例 #1
0
 public override void CheckContraints(Warnings warnings)
 {
     if (!MetaRepository.IsValidName(Name))
     {
         warnings.Add("Name must be alphanumeric", this);
     }
 }
コード例 #2
0
        public override void CheckContraints(Warnings warnings)
        {
            int container = AllAttributes().Count(property => property.IsContainer);

            if (container > 1)
            {
                warnings.Add("May not have more than one container", this);
            }
            if (!MetaRepository.IsValidName(Name))
            {
                warnings.Add("Name must be alphanumeric", this);
            }
            if (this != OBJECT && this != STRING && this != BOOLEAN && this != DATE && this != NUMBER)
            {
                if (_nestingPackage == null)
                {
                    warnings.Add("Must be owned by a package", this);
                }
                if (SuperClass == null)
                {
                    warnings.Add("Must have a superclass", this);
                }
                if (SuperClass == STRING && SuperClass == BOOLEAN && SuperClass == NUMBER)
                {
                    warnings.Add("May not have primitive superclass", this);
                }
            }
            else
            {
                //Assert nestingPackage == null;
                //Assert superclass == null;
                //Assert attributes.isEmpty();
            }

            var set = new HashSet <MetaDescription>
            {
                this
            };

            for (MetaDescription each = this; each == null; each = each.SuperClass)
            {
                if (!set.Add(each))
                {
                    warnings.Add("Superclass chain may not be circular", this);
                    break;
                }
            }
        }