Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.
Now you’ll modify the model so that the Entity Framework will use the UpdateOrder stored procedure defined in the database instead of generating its own command. You’ll do this by mapping the UpdateOrder stored procedure to the Order entity in the designer. This is referred to as Stored Procedure Mapping or Function Mapping.
1.In the designer, right click on the Order entity and select Stored Procedure mapping.
2.Click select Function="" Insert="" and then click the drop down arrow that appears. This exposes the list of all Functions found in the Store metadata.
3.Select InsertOrder from the list. The designer will do its best job of matching the stored procedure’s parameters with the entity properties using the names. In this case, since all of the property names match the parameter names, it maps every one correctly so you don’t need to make any changes. One thing that the designer was not able to map is the newly generated SalesOrderID returned by the stored procedure. This is because the designer is not able to automatically detect the name of the field being returned.
4.Under the Result Column Bindings section, click add Binding="" Result="" and enter SalesOrderID. The designer should automatically select the entity key property, OrderID, for this final mapping.
When completed, Figure 6 displays what the mapping should look like.
|Initial get page response times and IIS8||15||49|
|C# ASP.Net MVC Entity Framework: Unable to connect to the SQL database for cache dependency registration.||2||26|
|How to close an asp.net web form using C# ?||4||30|
|I've got an interview this morning and I want to sound intelligent...||4||47|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!