Solved

Entity Framework - Stored procedures

Posted on 2008-10-14
8
12,441 Views
Last Modified: 2013-11-11
I want to use the entity framework to call a stored procedure. I created a function import using the designer in visual studio.  VmwEwonInterfaceEntities is the name of my model and SpCalaculateValues is the name of my sp, so i want to execute this code:

            using (VmwEwonInterfaceEntities entities = new VmwEwonInterfaceEntities())
            {
                 entities.SpCalculateValues()
            }

The problem is that the stored procedure is not available on the model. Did i forgot something?

Urgent please, thanks in advance.
0
Comment
Question by:erwin_des
8 Comments
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi erwin_des;

When you added the class "Linq to SQL Classes" from the Add Item in the Solution Explorer and added the entity class did you drag the stored procedure from Server Explorer to the right panel of the entity designer?

Fernando
0
 

Author Comment

by:erwin_des
Comment Utility
I'm not using Linq to SQL Classes, i'm using a ADO.NEt Entity Data Model
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
Hi erwin_des;

I have not used this model but will look into this.

It seems that there are some extra stuff to deal with with Entity Data Model in adding a stored procedure. Below is an article showing how to implement a stored procedure with EDM. Look at the section marked "Stored Procedures in the Entity Model"
 
Stored Procedures in the Entity Model
http://msdn.microsoft.com/en-us/magazine/cc163286.aspx

I hope that this helps.

Fernando
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi erwin_des;

Here is some more information on stored procedures in the Entity Framework.

Stored Procedure Support (Entity Framework)
http://msdn.microsoft.com/en-us/library/bb399203.aspx

Fernando
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Closing Comment

by:erwin_des
Comment Utility
Thanks in probiding the links. It was usefull.
0
 
LVL 1

Expert Comment

by:BobCSD
Comment Utility
Here is a video that uses ado.net entity and stored procedures:
 
http://www.asp.net/learn/3.5-SP1/video-245.aspx
 
 
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Thanks.
0
 
LVL 1

Expert Comment

by:MohamedZaki
Comment Utility
Execute T-SQL Statements and stored using Entity framework 4
http://ledomoon.blogspot.com/2009/12/execute-t-sql-statements-and-stored.html
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now