nHydrate.Generator.Models.Table.IsInheritedFrom C# (CSharp) Method

IsInheritedFrom() public method

Determines if the specified table is an ancestor of the this table object
public IsInheritedFrom ( Table table ) : bool
table Table
return bool
        public bool IsInheritedFrom(Table table)
        {
            var t = this.ParentTable;
            while (t != null)
            {
                if (t == table) return true;
                t = t.ParentTable;
            }
            return false;
        }

Usage Example

示例#1
0
        public IEnumerable <Relation> GetRelationsWhereChild(Table table, bool fullHierarchy)
        {
            var retval = new List <Relation>();

            foreach (Relation relation in this.Relations)
            {
                var childTable = relation.ChildTableRef.Object as Table;
                if (childTable == table)
                {
                    retval.Add(relation);
                }
                else if (fullHierarchy && table.IsInheritedFrom(childTable))
                {
                    retval.Add(relation);
                }
            }
            return(retval);
        }
All Usage Examples Of nHydrate.Generator.Models.Table::IsInheritedFrom