Chain LINQ IQueryable, and end with Stored Procedure
- by Alex
I'm chaining search criteria in my application through IQueryable extension methods, e.g.:
public static IQueryable<Fish> AtAge (this IQueryable<Fish> fish, Int32 age)
{
return fish.Where(f => f.Age == age);
}
However, I also have a full text search stored procedure:
CREATE PROCEDURE [dbo].[Fishes_FullTextSearch]
@searchtext nvarchar(4000),
@limitcount int
AS
SELECT Fishes.* FROM Fishes
INNER JOIN CONTAINSTABLE(Fishes, *, @searchtext, @limitcount)
AS KEY_TBL ON Fishes.Id = KEY_TBL.[KEY]
ORDER BY KEY_TBL.[Rank]
The stored procedure obviously doesn't return IQueryable, however, is it possible to somehow limit the result set for the stored procedure using IQueryable's?
I'm envisioning something like .AtAge(5).AboveWeight(100).Fishes_FulltextSearch("abc").
In this case, the fulltext search should execute on a smaller subset of my Fishes table (narrowed by Age and Weight).
Is something like this possible? Sample code?