This article will demonstrate how to use the Entity
Framework 4 to execute stored procedures that create, read, update, and delete
(CRUD) records from a SQL Server database. This article builds upon the
database that was generated in the first article, Create
a Database Using Model First Development, and creates the same web page as
in Part 2. The web page functions the same except that it executes stored
procedures rather than rely on the Entity Framework to create the dynamic SQL
to access the database. You'll need to download Visual Studio 2010 RC 1 from
Microsoft's site in order for the sample code to work. You can download the
sample code and database script here (code) (script).
The goal of this article is to create a web page that allows
a user to maintain the records in the UserAccounts table. The final web page
looks like the following image.
The drop down list at the top of the page allows you to
navigate from user to user and display's the properties on the page. The user
can simply click the Save button to add or update records or click the Delete
button to remove a record.