Click here to Skip to main content
15,904,155 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi all,

My question is, can we call SP's from EF as we call using ADO.Net commands. If Yes, can you please post some sample codes.

I have just started working on .Net MVC 4+ EF 5(ORM). But don't have much idea how EF works.
Is EF is better than ADO.Net objects?. I am new to this type of coding. So need some clarification on this.

Thanks in Advance.

Jagadisha
Posted
Comments
Eduard Keilholz 30-Sep-13 10:25am    
What have you tried so far?

1 solution

Here is a simple example to populate a dropdownlist!

DataContext is the entity model file where you drag and drop your stored procedure which in turns generate automatic code for the MyStoredProcedureName SP and you can use it like this.


C#
using(DataContext context = new DataContext())
{ 
                    var result = context.MyStoredProcedureName();
                    MyDropDownList.DataSource = result ;
                    MyDropDownList.DataBind();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900