If I write a stored procedure and invoke it using Linq-to-SQL and perform (or rather compose) few more queries on the resultant set, how will it be executed? Will the stored procedure execute first and the composed query be executed on the stored procedure’s result?
Thanks for any pointers.
What you said is correct. The stored procedure will execute, return a result set (an
IEnumerableI think), and then your other queries will execute against the result set.Note: L2S often has problems getting the type of a stored procedure result set correct. Often times it will create a reference to the stored procedure with no result set (return type of void). And it doesn’t seem to be predictable. Because of this, I’ve stopped querying against stored procedures and query against user-defined functions. I’ve never had this sort of problem with a UDF.