public TableJoin GetTableJoinForPropertyPath(string propertyPath) { ArrayList propertyMaps = propertyPathTraverser.GetPathPropertyMaps(propertyPath); ArrayList joins = tableJoins; TableJoin theTableJoin = null; foreach (IPropertyMap propertyMap in propertyMaps) { theTableJoin = null; foreach (TableJoin tableJoin in joins) { if (tableJoin.PropertyMap == propertyMap) { theTableJoin = tableJoin; break; } } if (theTableJoin == null) { return(null); } joins = theTableJoin.Children; } return(theTableJoin); }
public string GetPropertyPath() { string path = this.propertyMap.Name; TableJoin p = this.Parent; while (p != null) { path = p.propertyMap.Name + "." + path; p = p.Parent; } return(path); }
public void SetupJoin(IPropertyMap propertyMap, IPropertyMap parentMap, string propertyPath, JoinType joinType) { TableJoin tableJoin = GetTableJoinForPropertyPath(propertyPath); if (tableJoin == null) { tableJoin = new TableJoin(); tableJoin.PropertyMap = propertyMap; tableJoin.JoinType = joinType; if (parentMap == null) { tableJoin.JoinTree = this; this.propertyPathTraverser.SqlEmitter.GetTableAlias(propertyMap.MustGetTableMap(), propertyMap); } else { //make sure the table has an alias tableJoin.Parent = GetTableJoinForPropertyPath(propertyPath.Substring(0, propertyPath.Length - propertyMap.Name.Length - 1)); this.propertyPathTraverser.SqlEmitter.GetTableAlias(propertyMap.MustGetTableMap(), tableJoin.Parent); } } }