public SqlString GetWithClause(string path, string pathAlias)
        {
            var key = new AliasKey(pathAlias, path);

            withClauseMap.TryGetValue(key, out var crit);

            return(crit?.ToSqlString(GetCriteria(path, key.Alias), this));
        }
        public ICriteria GetCriteria(string path, string critAlias)
        {
            var key = new AliasKey(critAlias, path);

            associationPathCriteriaMap.TryGetValue(key, out var result);
            logger.Debug("getCriteria for {0}: crit={1}", key, result);
            return(result);
        }
        private void CreateAssociationPathCriteriaMap()
        {
            foreach (var crit in rootCriteria.IterateSubcriteria())
            {
                var wholeAssociationPath = GetWholeAssociationPath(crit, out var parentAlias);
                if (parentAlias == null)
                {
                    parentAlias = rootCriteria.Alias;
                }

                if (!associationAliasToChildrenAliasesMap.TryGetValue(parentAlias, out var children))
                {
                    children = new HashSet <string>();
                    associationAliasToChildrenAliasesMap.Add(parentAlias, children);
                }
                children.Add(crit.Alias);

                var key = new AliasKey(crit.Alias, wholeAssociationPath);
                try
                {
                    associationPathCriteriaMap.Add(key, crit);
                }
                catch (ArgumentException ae)
                {
                    throw new QueryException("duplicate association path: " + key, ae);
                }

                try
                {
                    associationPathJoinTypesMap.Add(key, crit.JoinType);
                }
                catch (ArgumentException ae)
                {
                    throw new QueryException("duplicate association path: " + key, ae);
                }

                try
                {
                    withClauseMap.Add(key, crit.WithClause);
                }
                catch (ArgumentException ae)
                {
                    throw new QueryException("duplicate association path: " + key, ae);
                }
            }
        }