Skip to content

Commit 5a0ce95

Browse files
Merge pull request #254 from njqdev/master
Add Query.GetComment()
2 parents 96e54f3 + 5d9354b commit 5a0ce95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

QueryBuilder/Query.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ namespace SqlKata
88
{
99
public partial class Query : BaseQuery<Query>
1010
{
11+
private string comment;
12+
1113
public bool IsDistinct { get; set; } = false;
1214
public string QueryAlias { get; set; }
1315
public string Method { get; set; } = "select";
14-
public string QueryComment { get; set; }
1516
public List<Include> Includes = new List<Include>();
1617
public Dictionary<string, object> Variables = new Dictionary<string, object>();
1718

@@ -25,6 +26,8 @@ public Query(string table, string comment = null) : base()
2526
Comment(comment);
2627
}
2728

29+
public string GetComment() => comment ?? "";
30+
2831
public bool HasOffset(string engineCode = null) => GetOffset(engineCode) > 0;
2932

3033
public bool HasLimit(string engineCode = null) => GetLimit(engineCode) > 0;
@@ -63,9 +66,14 @@ public Query As(string alias)
6366
return this;
6467
}
6568

69+
/// <summary>
70+
/// Sets a comment for the query.
71+
/// </summary>
72+
/// <param name="comment">The comment.</param>
73+
/// <returns></returns>
6674
public Query Comment(string comment)
6775
{
68-
QueryComment = comment;
76+
this.comment = comment;
6977
return this;
7078
}
7179

0 commit comments

Comments
 (0)