コード例 #1
0
        /// <inheritdoc />
        public IQueryBuilder Add(IQueryPart queryPart)
        {
            var target = new QueryBuilderX(this);

            target.ContainerObject.Add(queryPart);
            return(target);
        }
コード例 #2
0
        /// <summary>
        ///     Inserts a TOP statement
        /// </summary>
        /// <typeparam name="TPoco"></typeparam>
        /// <param name="query">The query.</param>
        /// <param name="top">The top.</param>
        /// <returns></returns>
        /// <exception cref="NotSupportedException">For the Selected DB type is no Top implementations Available</exception>
        public static ElementProducer <TPoco> Top <TPoco>(this ElementProducer <TPoco> query, uint top)
        {
            if (query.ContainerObject.AccessLayer.Database.TargetDatabase != DbAccessType.MsSql)
            {
                throw new InvalidOperationException(string.Format("Invalid Target Database {0} by using the MSSQL extentions", query.ContainerObject.AccessLayer.Database.TargetDatabase));
            }

            QueryBuilderX wrapper = new QueryBuilderX(query.ContainerObject.AccessLayer).QueryD(string.Format("SELECT TOP {0} * FROM (", top)).Append(query).QueryD(")");

            return(new ElementProducer <TPoco>(wrapper));
        }
コード例 #3
0
        public QueryBuilderX Append(QueryBuilderX right)
        {
            if (right.ContainerObject == ContainerObject)
            {
                return(this);
            }

            var builder = this;

            foreach (var part in right.ContainerObject.Parts)
            {
                builder = builder.Add(part);
            }
            return(builder);
        }