Summing up some of the other answers as well as adding a bit of additional information:
Connect to your data source using the Default (LINQ to SQL) driver. Make sure that the check box Include Stored Procedures and Functions is checked.
Stored procedures and functions are now available as .NET functions (e.g. C#) in queries using the connection. The parameters required by the function reflects the parameters required by the stored procedure or database function.
The value returned by the function is a ReturnDataSet
which is a LINQPad type deriving from DataSet
. Unfortunately it is not so easy to perform LINQ queries on data sets but LINQPad provides the extension method AsDynamic()
that will take the first table of the returned data set (normally there is only one table) and convert the rows to IEnumerable<Object>
where the objects in the collection are dynamic allowing you to access the column values as properties. E.g. if your stored procedure returns columns Id
and Name
you can use LINQ:
SomeStoredProc().AsDynamic().Where(row => row.Id == 123 && row.Name == "Foo")
Unfortunately you will not have intellisense because the row objects are dynamic.