Is it possible to add functionality to enable querying of untyped objects e.g.
dictionaries?
Code
[Queryable]
public List<Dictionary<string, object>> Get()
{
var testSource = new List<Dictionary<string, object>>();
for (var i = 0; i < 3; i++)
{
var e = new Dictionary<string, object>();
e["Id"] = i;
e["Notes"] = "Lorem Ipsum " + i;
e["Date"] = new DateTime(1988 + i, 02, 02);
testSource.Add(e);
}
return testSource;
}
Output
[
{
"Id": 0,
"Notes": "Lorem Ipsum 0",
"Date": "1988-02-02T00:00:00Z"
},
{
"Id": 1,
"Notes": "Lorem Ipsum 1",
"Date": "1989-02-02T00:00:00Z"
},
{
"Id": 2,
"Notes": "Lorem Ipsum 2",
"Date": "1990-02-02T00:00:00Z"
}
]
How hard would it be to implement querying for following scenario? It would be
awesome for querying key/value stores that are taken from database and you
have no knowing beforehand what keys and values you have. Right now there is
no option to query these types of objects/dictionaries.
Original CodePlex Issue: Issue 1310
Status: Proposed
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Sep 20, 2013 at 6:42 PM
Reported by: StanislavRomanov
Updated on: Nov 5, 2013 at 1:36 PM
Updated by: stefjnl
+1
This is very much needed. However right now we have plugins like https://github.com/Roysvork/LinqToQuerystring that can accomplish this.
+1
Very much needed. Need [Queryable] to work over untyped (non CLR) object like following.
var keyProperty = productEntity.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
productEntity.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
productEntity.AddStructuralProperty("Price", EdmPrimitiveTypeKind.Double);
productEntity.AddStructuralProperty("Category", EdmPrimitiveTypeKind.String);
Would LinqToQuerystring work on above kind of untyped object?
Most helpful comment
+1
Very much needed. Need [Queryable] to work over untyped (non CLR) object like following.
var keyProperty = productEntity.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
productEntity.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
productEntity.AddStructuralProperty("Price", EdmPrimitiveTypeKind.Double);
productEntity.AddStructuralProperty("Category", EdmPrimitiveTypeKind.String);
Would LinqToQuerystring work on above kind of untyped object?