Entity framework stored procedure always returning int

October 5, 2015

http://www.devtoolshed.com/using-stored-procedures-entity-framework-scalar-return-values

http://stackoverflow.com/questions/18245567/stored-procedure-returns-int-instead-of-result-set

I have a stored procedure that contains dynamic select. Something like this:

ALTER PROCEDURE [dbo].[usp_GetTestRecords]
–@p1 int = 0,
–@p2 int = 0
@groupId nvarchar(10) = 0
AS
BEGIN
SET NOCOUNT ON;

DECLARE @query NVARCHAR(max)

SET @query = ‘SELECT * FROM CUSTOMERS WHERE Id = ‘ + @groupId
/* This actually contains a dynamic pivot select statement */

EXECUTE(@query);
END

Answer :

SET FMTONLY OFF

or

Advertisements

Entity Framework notes

May 24, 2015

How do I delete multiple rows in Entity Framework (without foreach)

db.People.RemoveRange(db.People.Where(x => State == “CA”));

How to delete single row in Entity Framework

use remove() method