Skip to content

Commit

Permalink
simple-distinct (#17)
Browse files Browse the repository at this point in the history
* simple-distinct

* Update SelectTranslatorTests.cs
  • Loading branch information
barnuri authored Jan 21, 2025
1 parent d159f4d commit 6677da8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LinqToKql.Test/Translator/SelectTranslatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Task Translate_ShouldHandleDistinctByAsync()
public Task Translate_ShouldHandleDistinctAsync()
=> AssertQueryAsync(
_q.Select(x => new { x.Name, x.Id }).Distinct(),
[_tableName, "project Name, Id", "distinct Name, Id"]
[_tableName, "project Name, Id", "distinct *"]
);

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions LinqToKql/Translator/Builders/SelectLinqToKQLTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public override string Handle(MethodCallExpression methodCall, Expression? paren
{
if (methodCall.Method.Name == nameof(Enumerable.Distinct))
{
var elementType = methodCall.Arguments[0].Type.GetGenericArguments().First();
var properties = elementType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
var propNames = properties.Select(p => p.Name).ToArray();
return $"distinct {string.Join(", ", propNames)}";
// var elementType = methodCall.Arguments[0].Type.GetGenericArguments().First();
// var properties = elementType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
// var propNames = properties.Select(p => p.Name).ToArray();
return $"distinct *";
}

var lambda = (LambdaExpression)((UnaryExpression)methodCall.Arguments[1]).Operand;
Expand Down

0 comments on commit 6677da8

Please sign in to comment.