Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 4ad42dc

Browse files
committed
Use nameof to determine Sql methods
1 parent 0307240 commit 4ad42dc

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/ServiceStack.OrmLite/Expressions/SqlExpression.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,33 +2154,33 @@ protected virtual object VisitSqlMethodCall(MethodCallExpression m)
21542154

21552155
switch (m.Method.Name)
21562156
{
2157-
case "In":
2157+
case nameof(Sql.In):
21582158
statement = ConvertInExpressionToSql(m, quotedColName);
21592159
break;
2160-
case "Desc":
2160+
case nameof(Sql.Desc):
21612161
statement = $"{quotedColName} DESC";
21622162
break;
2163-
case "As":
2163+
case nameof(Sql.As):
21642164
statement = $"{quotedColName} AS {DialectProvider.GetQuotedColumnName(RemoveQuoteFromAlias(args[0].ToString()))}";
21652165
break;
2166-
case "Sum":
2167-
case "Count":
2168-
case "Min":
2169-
case "Max":
2170-
case "Avg":
2166+
case nameof(Sql.Sum):
2167+
case nameof(Sql.Count):
2168+
case nameof(Sql.Min):
2169+
case nameof(Sql.Max):
2170+
case nameof(Sql.Avg):
21712171
statement = $"{m.Method.Name}({quotedColName}{(args.Count == 1 ? $",{args[0]}" : "")})";
21722172
break;
2173-
case "CountDistinct":
2173+
case nameof(Sql.CountDistinct):
21742174
statement = $"COUNT(DISTINCT {quotedColName})";
21752175
break;
2176-
case "AllFields":
2176+
case nameof(Sql.AllFields):
21772177
var argDef = m.Arguments[0].Type.GetModelMetadata();
21782178
statement = DialectProvider.GetQuotedTableName(argDef) + ".*";
21792179
break;
2180-
case "JoinAlias":
2180+
case nameof(Sql.JoinAlias):
21812181
statement = args[0] + "." + quotedColName.ToString().LastRightPart('.');
21822182
break;
2183-
case "Custom":
2183+
case nameof(Sql.Custom):
21842184
statement = quotedColName.ToString();
21852185
break;
21862186
default:

0 commit comments

Comments
 (0)