/// <summary> /// Find all relationships that have a specific child table /// </summary> /// <param name="table">The table from which all relations begin</param> /// <param name="includeHierarchy">Determines if the return includes all tables in the inheritence tree</param> /// <returns></returns> public ReadOnlyCollection <ViewRelation> FindByChildTable(CustomView table) { try { var retval = new List <ViewRelation>(); var tableList = new List <Table>(); var columnList = new List <CustomViewColumn>(); tableList = new List <Table>(); columnList.AddRange(table.GetColumns()); foreach (ViewRelation relation in this) { var childTable = relation.ChildView; foreach (ViewColumnRelationship columnRelationship in relation.ColumnRelationships) { foreach (var column in columnList) { if (!retval.Contains(relation)) { retval.Add(relation); } } } } return(retval.AsReadOnly()); } catch (Exception ex) { throw; } }
private void AppendMappingFragment(CustomView view) { sb.AppendFormat(" <MappingFragment StoreEntitySet=\"{0}\">", view.PascalName).AppendLine(); sb.AppendLine(" <ScalarProperty Name=\"pk\" ColumnName=\"__pk\" />"); foreach (var currentColumn in view.GetColumns().Where(x => x.Generated).OrderBy(x => x.Name)) { sb.AppendFormat(" <ScalarProperty Name=\"{0}\" ColumnName=\"{1}\" />", currentColumn.PascalName, currentColumn.DatabaseName).AppendLine(); } sb.AppendFormat(" </MappingFragment>").AppendLine(); }