示例#1
0
        internal MetaTable GetTableNoLocks(Type rowType)
        {
            MetaTable table;

            if (!metaTables.TryGetValue(rowType, out table))
            {
                Type key = GetRoot(rowType) ?? rowType;

                /*
                 * var customAttributes = (TableAttribute[])key.GetCustomAttributes(typeof(TableAttribute), true);
                 * if (customAttributes.Length == 0)
                 * {
                 *  metaTables.Add(rowType, null);
                 *  return table;
                 * }
                 */
                var tableAttribute = AttributeProvider.GetTableAttribute(key);
                if (tableAttribute == null)
                {
                    metaTables.Add(rowType, null);
                    return(table);
                }

                if (!metaTables.TryGetValue(key, out table))
                {
                    /* table = new AttributedMetaTable(this, customAttributes[0], key); */
                    table = new AttributedMetaTable(this, tableAttribute, key);

                    foreach (MetaType type2 in table.RowType.InheritanceTypes)
                    {
                        metaTables.Add(type2.Type, table);
                    }
                }
                if (table.RowType.GetInheritanceType(rowType) == null)
                {
                    metaTables.Add(rowType, null);
                    return(null);
                }
            }
            return(table);
        }