Esempio n. 1
0
        /// <summary>
        /// Returns all objects of the specified type that are valid 'beneath' the supplied rootObject. This typically gets called
        /// when analysis and generation begins and the objects get passed to the template to create the output files.
        /// </summary>
        /// <param name="typeName">Fully qualified name of the type of objects to return.</param>
        /// <param name="rootObject">Object by which the results must get filtered.</param>
        /// <returns>An arra of objects of the specified type.</returns>
        public override IEnumerable <ArchAngel.Interfaces.IScriptBaseObject> GetAllObjectsOfType(string typeName, ArchAngel.Interfaces.IScriptBaseObject rootObject)
        {
            if (rootObject == null)
            {
                return(GetAllObjectsOfType(typeName));
            }
            ArchAngel.Interfaces.IScriptBaseObject[] results = new ArchAngel.Interfaces.IScriptBaseObject[0];
            string rootObjectTypeName = rootObject.GetType().FullName;

            switch (rootObjectTypeName)
            {
            case "Demo.Providers.Test.School":
                switch (typeName)
                {
                case "Demo.Providers.Test.Pupil":
                    results = ((School)rootObject).Pupils.ToArray();
                    break;

                default:
                    throw new NotImplementedException(string.Format("GetAllObjectsOfType does not yet cater for objects of type [{0} with with a rootObject of type [{1}].", typeName, rootObjectTypeName));
                }
                break;

            case "Demo.Providers.Test.Pupil":
                throw new NotImplementedException(string.Format("GetAllObjectsOfType does not yet cater for objects of type [{0} with with a rootObject of type [{1}].", typeName, rootObjectTypeName));

            default:
                throw new NotImplementedException(string.Format("This type of rootObject hasn't been handled yet: {0} in the Demo.Providers.Test assembly.", rootObjectTypeName));
            }
            return(results);
        }