A stored procedure is nothing more than prepared SQL code that you save so you can reuse the code over and over again. The commands in a procedure are executed as a single batch of code.
- Resue of code.
- Easier in maintenance
- Improved performance
NMemory provides a class StoredProcedureCollection which represents a collection of the stored procedure in a database. StoredProcedureCollection.Create method creates a stored procedure and it takes an IQueryable object as an argument.
A shared, stored procedure creates the query every time the Execute method is called.