Solved

Entity Framework - Stored procedures

Posted on 2008-10-14
8
12,449 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
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Easy filter aspnet 2 44
Visual Studio hangs on running project 6 80
Groupbox Control ? 2 36
vb.net application has warrnings about VB6 calls. 2 40
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

731 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