hi,
i want to use stored procedure in entity framework with returning list.but i got error in model.context class i.e isingleresult cannot convert
into list .please give me solution .its urgent
thanks in advance
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
saswat kumarPosted Sep 19, 2014, 1:17 AM
Thanks for ur response.please check my code . i m not able to find where is the mistake i have done.In my code, my stored procedure name is getdata() and table name is emp.In modelbrowser, I set return type to entity:emp.my business logic code is
public List
{
MYDBEntities obj = new MYDBEntities();
var x = from n in obj.getdata
return x.ToList
}
i find error that stored procedure getdata() is a nongeneric method.in model.conext.cs,
the return type is not changed after setting return type to entity:emp.
thanks in advance
Jignesh TrivediPosted Sep 18, 2014, 11:21 PM
Hi,
I am not sure what you do in coding...
Please refer my article
http://www.c-sharpcorner.com/UploadFile/ff2f08/call-store-procedure-from-entity-framework/
http://www.c-sharpcorner.com/UploadFile/ff2f08/code-first-stored-procedure-entity-framework-6-0/
hope this will help you.