Ejemplo n.º 1
0
        protected static GenObject GetFirstObjectOfSubClass(GenObject genObject, string subClassName)
        {
            Contract.Requires(genObject != null, "The object cannot be null");
            Contract.Requires(genObject.Definition != null, "The object definition is required");
            var index = genObject.Definition.IndexOfSubClass(subClassName);

            if (index == -1)
            {
                throw new ArgumentException("Class is not a subclass", subClassName);
            }
            var subClass = genObject.GetSubClass(subClassName);

            return(subClass.Count == 0 ? null : subClass[0]);
        }
Ejemplo n.º 2
0
        private ISubClassBase GetSubClassBase()
        {
            Contract.Ensures(Contract.Result <ISubClassBase>() != null);
            if (GenCardinality != GenCardinality.Inheritance)
            {
                var subClass = GenObject.GetSubClass(ClassName);
                return(subClass);
            }

            ISubClassBase subClassBase = new GenSubClass(GenObject.GenDataBase, GenObject, ClassId, GenObject.ParentSubClass.Definition);

            if (GenObjectClassId(GenObject) == ClassId)
            {
                subClassBase.Add(GenObject);
            }
            return(subClassBase);
        }