Ejemplo n.º 1
0
        public IQueryFactoryResult Process(IQueryContainer container)
        {
            var joinBuilder = new StringBuilder();

            joinBuilder.Append($"{_joinAs.JoinType} JOIN {TargetTable.GetAlias().EnsureAlias()} AS {Alias.GetAlias().EnsureAlias()}" +
                               $" ON {Alias.GetAlias().EnsureAlias()}.{TargetColumn.ColumnName.EnsureAlias()}" +
                               $" = " +
                               $"{SourceTable.GetAlias().EnsureAlias()}.{SourceColumn.ColumnName.EnsureAlias()}");

            var parameters = new List <IQueryParameter>();

            if (Condition != null)
            {
                var condQueryBuilder = new ConditionalQueryBuilder();
                condQueryBuilder.QueryBuilder.Append(" ");
                foreach (var conditionCondition in Condition.Conditions)
                {
                    conditionCondition.Render(condQueryBuilder, null);
                }

                joinBuilder.Append(condQueryBuilder.QueryBuilder);
                parameters.AddRange(condQueryBuilder.QueryParameters);
            }

            return(new QueryFactoryResult(joinBuilder.ToString(), parameters.ToArray()));
        }
Ejemplo n.º 2
0
        public IQueryFactoryResult Process(IQueryContainer container)
        {
            var joinBuilder = new StringBuilder();

            joinBuilder.Append($"{_joinAs.JoinType} JOIN [{TargetTable.GetAlias()}] AS [{Alias.GetAlias()}]" +
                               $" ON [{Alias.GetAlias()}].[{TargetColumn.ColumnName.TrimAlias()}]" +
                               $" = " +
                               $"[{SourceTable.GetAlias()}].[{SourceColumn.ColumnName}]");
            return(new QueryFactoryResult(joinBuilder.ToString()));
        }