示例#1
0
            public void Build(ISqlBuilder sqlBuilder, StringBuilder stringBuilder, SqlQueryExtension sqlQueryExtension)
            {
                var value = (SqlValue)sqlQueryExtension.Arguments["indexName"];
                var count = (int)((SqlValue)sqlQueryExtension.Arguments["columns.Count"]).Value !;

                if (count == 0)
                {
                    stringBuilder
                    .Append("ForceSeek, Index(")
                    .Append(value.Value)
                    .Append(')')
                    ;
                }
                else
                {
                    stringBuilder
                    .Append("ForceSeek(")
                    .Append(value.Value)
                    .Append('(')
                    ;

                    for (var i = 0; i < count; i++)
                    {
                        sqlBuilder.BuildExpression(sqlBuilder.StringBuilder, sqlQueryExtension.Arguments[$"columns.{i}"], false);
                        stringBuilder.Append(", ");
                    }

                    stringBuilder.Length -= 2;
                    stringBuilder.Append("))");
                }
            }