MVC 2 Entity framework 4 how do I execute an insert stored procedure

Posted on 2010-11-08
Last Modified: 2013-11-08
MVC 2 Entity framework 4 how do I execute an insert stored procedure and pass parameters?
Question by:jonatec
  • 3
  • 3
LVL 52

Expert Comment

by:Carl Tawn
ID: 34086418
Are you using ADO.Net or Entity Framework, or something else, or do you not mind?

Author Comment

ID: 34088344
Entity Framework
LVL 52

Expert Comment

by:Carl Tawn
ID: 34088390
You should be able to add a stored procedure to your model when you are defining it, in the same way that you would with a table.

For further reading check these: 
New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.


Author Comment

ID: 34091589
Thanks. At the Microsoft url you gave there is a comment:

"If you do not map all three of the insert, update, and delete operations  of an entity type to stored procedures, the unmapped operations will  fail if executed at runtime, and an UpdateException will be thrown."

Do you know how to set up just one stored procedure for an insert and not set up sprocs for update and delete ?
LVL 52

Accepted Solution

Carl Tawn earned 500 total points
ID: 34091621
All that is basically saying is that if you don't map the SELECT or UPDATE, but then attempt to Select or Update that model then the calls will fail because there will be no mapping.

As long as you understand that, and don't attempt a Select or Update, then you should be ok.

Author Closing Comment

ID: 34092767
Yeah, that's excellent thanks !!!

Featured Post

Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

17 Experts available now in Live!

Get 1:1 Help Now