예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
                }
            }
        }