Exemplo n.º 1
0
        private void AutoJoin(JoinChainer source)
        {
            if (!source.HasNode)
            {
                throw JoinerException(source, (TableChainer)null, QueryTalkExceptionType.InvalidJoinTable);
            }

            bool         found  = false;
            TableChainer target = null;
            var          ix     = _targets.Count - 1;

            while (ix >= 0)
            {
                target = _targets[ix];
                if (CheckAutoTarget(source, target))
                {
                    found = true;
                    break;
                }
                --ix;
            }

            if (!found)
            {
                throw JoinerAutoJoinFailedException(source);
            }

            var expression = _GetMappedExpression(source, target, DB3.Default);

            _InjectOn(source, expression);
            source.AppendJoinGraph(target.JoinGraph);
        }
Exemplo n.º 2
0
        private Expression AliasByJoin(JoinChainer source, ByArgument arg)
        {
            var target = _GetTargetByAlias(source, arg.Alias, true);

            if (!source.HasNode || !target.HasNode)
            {
                throw JoinerException(source, target, QueryTalkExceptionType.InvalidJoinTable);
            }

            var expression = _GetMappedExpression(source, target, DB3.Default);

            source.AppendJoinGraph(target.JoinGraph);

            return(expression);
        }