How to obtain column metadata from linq to Entities query?
I need to support legacy client and compose ADO datasets from our Linq queries. The problem is how get specific column information (varchar length, decimal precision, etc) that cannot be obtained using reflection.
for example, I have table Customer with field Name varchar(80)
When I fetch data from linq to entities query:
var data = (from c in ctx.Customers select c.Name).ToList()
I cannot obtain maxSize for the column data[i].Name and adodataset raises an error.
I already have simple solution:
- Code to extract column metadata from ObjectContext by property reference
- Simple code that parses expression from Queryable and links output properties to edm columns.
But I have a lot of issues parsing complex queries that include multiple nested groupbys/unions/joins etc.
Does anybody know any other way (maybe using materialization shaper or similar)?