I need to execute a dynamic set type, here's what I'm trying to do (pseudo):
var type = GetSetType(); //System.Type
var set = context.Set(type);
var results = set.ToArray();
I know this can't work for sure, Enumerable
ex. methods are only for generic IEnumerable
s, but I tried set.AsQueryable().Cast<object>().ToArray()
, and a NotSupportedException
was thrown: "LINQ to Entities only supports casting EDM primitive or enumeration types.".
Any way to execute a non-generic DbSet
?