Hi,
I'm wondering what the story is for System.Linq.Dynamic.Core and types that aren't known till runtime. Is this supported right now, and if it's not, will it be one day?
Right now, I have an IEnumerable<dynamic> I can that I'd like to query. Is there any way I can compose a query on top of that? Is there any other way you know of for handling this case?
(The collection contains ExpandoObjects from a JSON payload deserialized by Json.NET. I see you have a test for JObjects but we don't want to be bound to that type as we may have multiple serializers.)
There is a test in there for verifying a Select on a collection of dynamic objects, but it's disabled right now.
Repro
Run this test.
//[Fact]
public void ExpressionTests_Select_ExpandoObjects()
{
//Arrange
dynamic a = new ExpandoObject();
a.Name = "a";
a.BlogId = 100;
dynamic b = new ExpandoObject();
b.Name = "b";
b.BlogId = 100;
var list = new List<dynamic> { a, b };
IQueryable qry = list.AsQueryable();
var result = qry.Select("it").Select("BlogId");
//Assert
Assert.Equal(new[] { 100, 200 }, result.ToDynamicArray<int>());
}
Expected
Passes.
Actual
It's commented out. It fails when running it:
Message: System.Linq.Dynamic.Core.Exceptions.ParseException : No property or field 'BlogId' exists in type 'Object'
Hi,
I'm wondering what the story is for
System.Linq.Dynamic.Coreand types that aren't known till runtime. Is this supported right now, and if it's not, will it be one day?Right now, I have an
IEnumerable<dynamic>I can that I'd like to query. Is there any way I can compose a query on top of that? Is there any other way you know of for handling this case?(The collection contains
ExpandoObjects from a JSON payload deserialized by Json.NET. I see you have a test forJObjectsbut we don't want to be bound to that type as we may have multiple serializers.)There is a test in there for verifying a
Selecton a collection of dynamic objects, but it's disabled right now.Repro
Run this test.
Expected
Passes.
Actual
It's commented out. It fails when running it: