theshwaguy
theshwaguy

Reputation: 449

Retrieve data from a SQL Server stored procedure into a List<T>

I have this project that I am creating a library to handle all the data from multiple projects, I have organized the queries in stored procedures. I need to pass 4 parameters to the store procedure and get back some data. I cannot believe there is no easy way to accomplish this.

I have tried the datareader, datatable I do not want to have to iterate through the data as it does have the possibility to grow large.

Thank you for your help.

Upvotes: 0

Views: 1795

Answers (2)

Jakub Konecki
Jakub Konecki

Reputation: 46008

I would suggest using Dapper http://code.google.com/p/dapper-dot-net/

It's a micro ORM, much faster than EF - written by and used by guys behind SO ;-)

Note: I do not want to have to iterate through the data as it does have the possibility to grow large - someone will have to iterate through the result set - either you or the framework you will be using. Consider paging if you think you might get too much data at once.

Upvotes: 1

bugnuker
bugnuker

Reputation: 3968

Entity Framework is nice. Add new item > ADO.NET entity Model Generate from database select only the SP's, unless you want to import the table schema too.

Once it finds your SP's, it will create complex types for you and everything will be really easy.

entity Framework for the win.

Upvotes: 1

Related Questions