The Entity Framework permits you to use stored procedures in the Entity Data Model in its place of, or in permutation with, its automatic command group.
The following instance creates a new project from File → new → Project.
Step 1 − Select the Console Application from the middle panel and enter StoredProceduresDemo in the name field.
Step 2 − In Server explorer right-click on your database.
Step 3 − Select New Query and enter the following code in T-SQL editor to add a new table in your database.
Step 4 − Right-click on the editor and select Finish.
Step 5 − Right-click on your database and click refresh. You will see the newly added table in your database.
Step 6 − In Server explorer, right-click on your database again.
Step 7 − Select New Query and enter the following code in T-SQL corrector to add a stored procedure in your database, which will profit the Student grades.
Step 8 − Right-click on the editor and select Execute.
Step 9 − Right-click on your database and click refresh. You will see that a kept procedure is formed in your database.
Step 10 − Right-click on the project name in Solution Explorer and select Add → New Item.
Step 11 − Then select ADO.NET Entity Data Model in the Templates panel.
Step 12 − Enter Spode as name, and then click Add.
Step 13 − In the Select Model Substances dialog box, select EF designer from database, and then click Next.
Step 14 − Select your database and click Next.
Step 15 − In the Select Your Database Objects dialog box click on tables, views.
Step 16 − Select the GetStudentGradesForCourse function located under the Stored Procedures and Functions node and click Finish.
Step 17 − Select View → Other Windows → Entity Data Model Browser and right-click GetStudentGrades under Function Imports and select Edit.
It will produce the following conversation.
Step 18 − Click on Entities radio button and select Student Grade from the combo box as yield type of this stored procedure and click Ok.
Let’s take a look at the following C# code in which all the grades will be saved by passing the student ID as parameter in GetStudentGrades stored procedure.
When the above code is collected and performed you will receive the following output –
We recommend that you execute the above instance in a step-by-step method for better considerate.
Microsoft Entity Framework Related Interview Questions
|XML Interview Questions||HTML 5 Interview Questions|
|Microsoft Entity Framework Interview Questions||Framework7 Interview Questions|
|Oracle Performance Tuning Interview Questions||Windows Presentation Foundation(WPF) Interview Questions|
|Windows Communication Foundation (WCF) Interview Questions||Microsoft Foundation Class Library (MFC) Interview Questions|
|Net Micro Framework Interview Questions|
Microsoft Entity Framework Related Practice Tests
|XML Practice Tests||HTML 5 Practice Tests|
|Microsoft Entity Framework Practice Tests||Windows Presentation Foundation(WPF) Practice Tests|
|Windows Communication Foundation (WCF) Practice Tests|
Microsoft Entity Framework Tutorial
Microsoft Entity Framework
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.