public Relationship(string name, Table parent, Table child, bool allowOneToOne) { this.Name = name; this.ParentTable = parent; this.ChildTable = child; this._allowOneToOne = allowOneToOne; }
private IEnumerable<ExplorerItem> GetParents(Table t) { return (from p in t.ParentRelations orderby p.PropNameForChild select new ExplorerItem(p.PropNameForChild, ExplorerItemKind.ReferenceLink, p.IsOneToOne ? ExplorerIcon.OneToOne : ExplorerIcon.ManyToOne) { DragText = p.PropNameForChild, ToolTipText = p.ParentTable.DotNetName, Tag = p.ParentTable }); }
private IEnumerable<ExplorerItem> GetChildren(Table t) { return (from c in t.ChildRelations orderby c.PropNameForParent select new ExplorerItem(c.PropNameForParent, c.IsOneToOne ? ExplorerItemKind.ReferenceLink : ExplorerItemKind.CollectionLink, c.IsOneToOne ? ExplorerIcon.OneToOne : ExplorerIcon.OneToMany) { DragText = c.PropNameForParent, ToolTipText = c.IsOneToOne ? c.ChildTable.DotNetName : ("IEnumerable <" + c.ChildTable.DotNetName + ">"), Tag = c.ChildTable }); }