Solved

Entity Framework - Stored procedures

Posted on 2008-10-14
8
12,448 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 22711223
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
ID: 22711957
I'm not using Linq to SQL Classes, i'm using a ADO.NEt Entity Data Model
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 22714694
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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 63

Expert Comment

by:Fernando Soto
ID: 22723422
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
 

Author Closing Comment

by:erwin_des
ID: 31505798
Thanks in probiding the links. It was usefull.
0
 
LVL 2

Expert Comment

by:Starr Duskk
ID: 22907597
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 63

Expert Comment

by:Fernando Soto
ID: 22908303
Thanks.
0
 
LVL 1

Expert Comment

by:MohamedZaki
ID: 25941839
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…

735 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