Seems like you would want to build an
IQueryable<T>
. Search on Dynamic Query Expression on EF to get more information. Here's one example that may help you get started:
Dynamic Query Expressions With Entity Framework | Code with the wind[
^]
If you are expecting a different set of results then you can use
IEnumerable<dynamic>
to return anonymous object based from row sql dynamic query.
Also, if you want to take advantage of the new features of EF including full support of storedprocedures then you want to look at EF 6 instead:
Entity Framework Code First and Stored Procedures[
^]