Manually Link Stored Procedure To LINQ

I have a Stored Procedure that returns a dynamic result set based on a temporary table. My project uses LINQ for Data Access, but I can’t incorporate LINQ with this Stored Procedure because it has a dynamic “shape” (I can’t say before hand which columns will come back or how many there will be), so LINQ can’t generate at design time an object that can hold the results.

I am trying to integrate the stored procedure the old fashioned was, using SQLDataAdapter and such, but I was hoping that I could still tie into LINQ so that I don’t need to manage a separate transaction mechanism as that would be a disaster.

  • How to transpose columns to rows in sql server
  • How to hide security node and logins from some users in SQL?
  • Compare tools to generate update script for SQL server
  • Given longitude and latitude of two areas, how to find the distance between them in meters. How to query in SQL..?
  • Exporting SharePoint usage log files into a database using LogParser
  • How to use local variables in stored procedures?
  • Is this possible? Thanks.

  • Jdbc Connection Pool with Sql Server 2008 fails
  • Using the 'Use' command, or equivilant to point to a different server
  • Coding function calculate age from a DOB
  • SQL Server 2012 dynamic pivot - concatenation for cross tab
  • Difference between JOIN and INNER JOIN
  • Looping lines in SQL
  • 2 Solutions collect form web for “Manually Link Stored Procedure To LINQ”

    One best practice is that a stored procedure should never be coded such that it gives different columns in a result set based on inputs.

    It sounds like your design is causing the single stored proc to try and do too many things. I’d highly suggest you change this.

    First – you aren’t using “LINQ” for data access. My guess is you are using Entity Framework for data access. If you are, it depends on which version of EF you are using.

    New in Entity Framework 4 is shaping data from a stored proc. For step-by-step instructions, see this blog post:

    If you are using Entity Framework 1, which comes with .NET 3.5, then no EF does not have the ability to sense the shape of the stored proc data.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.