?
Solved

Entity Framework - Stored procedures

Posted on 2008-10-14
8
Medium Priority
?
12,452 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 1500 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

771 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