advancing but not there yet.
This commit is contained in:
parent
9f7e8bfc4e
commit
406290df78
@ -82,11 +82,15 @@ namespace PoweredSoft.DynamicLinq.Test
|
|||||||
{
|
{
|
||||||
var query = TestData.Authors.AsQueryable();
|
var query = TestData.Authors.AsQueryable();
|
||||||
|
|
||||||
query.Select(t => new
|
var qs = query.Select(t => new
|
||||||
{
|
{
|
||||||
Comments = t.Posts == null ? null : t.Posts.SelectMany(t2 => t2.Comments).ToList()
|
CommentLikes = t.Posts == null ?
|
||||||
|
new List<CommentLike>() :
|
||||||
|
t.Posts.Where(t2 => t2.Comments != null).SelectMany(t2 => t2.Comments.Where(t3 => t3.CommentLikes != null).SelectMany(t3 => t3.CommentLikes)).ToList()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var a = qs.ToList();
|
||||||
|
|
||||||
var querySelect = query.Select(t =>
|
var querySelect = query.Select(t =>
|
||||||
{
|
{
|
||||||
t.NullChecking(true);
|
t.NullChecking(true);
|
||||||
|
@ -168,6 +168,12 @@ namespace PoweredSoft.DynamicLinq.Test
|
|||||||
Content = "ASD"
|
Content = "ASD"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new Author
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
FirstName = "Mark",
|
||||||
|
LastName = "Ronson"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,8 @@ namespace PoweredSoft.DynamicLinq.Helpers
|
|||||||
var notGroupedType = expr.Type.GenericTypeArguments.FirstOrDefault();
|
var notGroupedType = expr.Type.GenericTypeArguments.FirstOrDefault();
|
||||||
if (notGroupedType == null)
|
if (notGroupedType == null)
|
||||||
throw new Exception($"Path must be a Enumerable<T> but its a {expr.Type}");
|
throw new Exception($"Path must be a Enumerable<T> but its a {expr.Type}");
|
||||||
|
|
||||||
var body = Expression.Call(typeof(Enumerable), "ToList", new[] { notGroupedType }, expr);
|
var body = Expression.Call(typeof(Enumerable), "ToList", new[] { notGroupedType }, expr) as Expression;
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user