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(", ")); }
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); }
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()); }