No, you cannot get IQueryable from SqlQuery * because what IQueryable does builds the SQL string dynamically based on what it selects and where you filter it. Since you provide a string in SqlQuery , the Entity Framework cannot generate this dynamic string.
Your parameters either dynamically build a line in which your I should go to SqlQuery , and use it as IEnumerable instead of IQueryable or use the DbSet in your DbContext and do a more βnormalβ way of providing an object structure for you.
* You can technically by calling AsQueryable () as a result, but itβs just IEnumerable pretending to be IQueryable, it does not give you any advantages of using the βRealβ IQueryable, for example, only to get the necessary lines from the server.
Scott Chamberlain Oct 01 2018-12-14T00: 00Z
source share