コード例 #1
0
        public virtual string GenerateSort(IDatabaseQuery query)
        {
            var parts = new List <string>();

            parts.AddRange(query.OrderByParts.Select(p => query.Column(p.Property) + " DESC".OnlyWhen(p.Descending)));

            return(parts.ToString(", "));
        }
コード例 #2
0
        public virtual string GenerateSort(IDatabaseQuery query)
        {
            var parts = new List <string>();

            parts.AddRange(query.OrderByParts.Select(p => query.Column(p.Property) + " DESC".OnlyWhen(p.Descending)));

            var offset = string.Empty;

            if (query.PageSize > 0)
            {
                offset = $" OFFSET {query.PageStartIndex} ROWS FETCH NEXT {query.PageSize} ROWS ONLY";
            }

            return(parts.ToString(", ") + offset);
        }
コード例 #3
0
        public virtual string GenerateWhere(IDatabaseQuery query)
        {
            var r = new StringBuilder();

            if (SoftDeleteAttribute.RequiresSoftdeleteQuery(query.EntityType))
            {
                query.Criteria.Add(new Criterion("IsMarkedSoftDeleted", false));
            }

            r.Append($" WHERE { query.Column("ID")} IS NOT NULL");

            foreach (var c in query.Criteria)
            {
                r.Append(Generate(query, c).WithPrefix(" AND "));
            }

            return(r.ToString());
        }