I have a couple of stored procedures in T-SQL where each stored procedure has a fixed schema for the result set.
I need to map the result sets for each procedure to a POCO object and need the column name and type for each column in the result set. Is there a quick way of accessing the information?
The best way I have found so far is accessing each stored procedure from .NET and writing my own extension method on a IDataReader/IDataRecord for dumping the information (column names and types) out.
Example, a stored procedure executing the following query:
SELECT Id, IntField, NullableIntField, VarcharField, DateField FROM SomeTable
would require me to have the mapping information:
Id - Guid
IntField - System.Int32
NullableIntField - Nullable<System.Int32>
VarcharField - String
DateField - DateTime