示例#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);
        }
示例#2
0
        /// <summary>
        /// Returns all objects of the specified type that currently exist in this provider. 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>
        /// <returns>An arra of objects of the specified type.</returns>
        public override IEnumerable <ArchAngel.Interfaces.IScriptBaseObject> GetAllObjectsOfType(string typeName)
        {
            ArchAngel.Interfaces.IScriptBaseObject[] results = new ArchAngel.Interfaces.IScriptBaseObject[0];

            switch (typeName)
            {
            case "Demo.Providers.Test.School":
                results = new ArchAngel.Interfaces.IScriptBaseObject[Schools.Count];

                for (int i = 0; i < Schools.Count; i++)
                {
                    School school = Schools[i];
                    results[i] = school;
                }
                break;

            case "Demo.Providers.Test.Pupil":
                int total = 0;

                foreach (School school in Schools)
                {
                    total += school.Pupils.Count;
                }
                results = new ArchAngel.Interfaces.IScriptBaseObject[total];
                int counter = 0;

                foreach (School school in Schools)
                {
                    foreach (Pupil pupil in school.Pupils)
                    {
                        results[counter] = pupil;
                        counter++;
                    }
                }
                break;

            default:
                throw new NotImplementedException(string.Format("This type of object hasn't been handled yet: {0} in the Demo.Providers.Test assembly.", typeName));
            }
            return(results);
        }
示例#3
0
        /// <summary>
        /// Returns all objects of the specified type that currently exist in this provider. 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>
        /// <returns>An arra of objects of the specified type.</returns>
        public override IEnumerable<ArchAngel.Interfaces.IScriptBaseObject> GetAllObjectsOfType(string typeName)
        {
            ArchAngel.Interfaces.IScriptBaseObject[] results = new ArchAngel.Interfaces.IScriptBaseObject[0];

            switch (typeName)
            {
                case "Demo.Providers.Test.School":
                    results = new ArchAngel.Interfaces.IScriptBaseObject[Schools.Count];

                    for (int i = 0; i < Schools.Count; i++)
                    {
                        School school = Schools[i];
                        results[i] = school;
                    }
                    break;
                case "Demo.Providers.Test.Pupil":
                    int total = 0;

                    foreach (School school in Schools)
                    {
                        total += school.Pupils.Count;
                    }
                    results = new ArchAngel.Interfaces.IScriptBaseObject[total];
                    int counter = 0;

                    foreach (School school in Schools)
                    {
                        foreach (Pupil pupil in school.Pupils)
                        {
                            results[counter] = pupil;
                            counter++;
                        }
                    }
                    break;
                default:
                    throw new NotImplementedException(string.Format("This type of object hasn't been handled yet: {0} in the Demo.Providers.Test assembly.", typeName));
            }
            return results;
        }
示例#4
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;
        }