Ejemplo n.º 1
0
        // Walks the type hierachy up to endingType (assuming startingType is a subtype of starting type)
        // trying to find a meta table.
        public static MetaTable GetTableFromTypeHierarchy(Type entityType)
        {
            if (entityType == null)
            {
                throw new ArgumentNullException("entityType");
            }

            Type type = entityType;

            while (type != null)
            {
                MetaTable table;
                if (MetaTable.TryGetTable(type, out table))
                {
                    return(table);
                }
                type = type.BaseType;
            }

            return(null);
        }