Creating an expression rewritter that work with members

This commit is contained in:
Zoe Roux
2020-09-11 00:35:21 +02:00
parent 8430f0f1d8
commit fb14eb4ef2
6 changed files with 56 additions and 24 deletions
+2 -1
View File
@@ -30,7 +30,7 @@ namespace Kyoo.Controllers
public Sort(Expression<Func<T, object>> key, bool descendant = false)
{
Key = key;
Key = ExpressionRewrite.Rewrite<Func<T, object>>(key);
Descendant = descendant;
if (Key == null ||
@@ -58,6 +58,7 @@ namespace Kyoo.Controllers
Key = property.Type.IsValueType
? Expression.Lambda<Func<T, object>>(Expression.Convert(property, typeof(object)), param)
: Expression.Lambda<Func<T, object>>(property, param);
Key = ExpressionRewrite.Rewrite<Func<T, object>>(Key);
Descendant = order switch
{