>Code2Code.net Home   >DB Linq Project Home  

Stored proc support in the official Microsoft Linq-to-SQL

In the Microsoft implementation (official Linq-to-SQL), stored procs are fully supported. By default, they won't appear in your mapping file database .cs file - you need to use the '-sprocs' flag to turn on support. Microsoft appears to use parsing of T/SQL  to determine the shape of resultset. On very complex procs, I have seen the parser crash (using Orcas Beta1).

Stored Procs in DB LINQ provider for MySql/PostgreSql

MySql differentiates between functions and procedures. Functions return a scalar of pre-defined type and cannot have OUT-parameters. Stored Procs, on the other had, can return a resultset and have multiple in/out parameters.
In DB Linq, we have full support for functions. However, there is no parsing functionality, and thus stored proc return a DataSet. (Actually, there is a simplistic parsing step, looking for the word 'select' in the body of the stored proc. If there is no select, we assume that it won't return a resultset)

Notes:
Turn on stored proc support via -sprocs
Stored Functions return typed results
Stored Procedures return DataSet or void

TODO:
Add a SqlMetal GUI screen where user could invoke the stored proc to determine shape of resultset.