What should you do in the ADO.NET Entity Framework Designer?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities. The model contains an entity type named Product.

You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method is executed after an attached Product has changed.
What should you do in the ADO.NET Entity Framework Designer?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application.
You use the ADO.NET Entity Framework Designer to model entities. The model contains an entity type named Product.

You need to ensure that a stored procedure will be invoked when the ObjectContext.SaveChanges method is executed after an attached Product has changed.
What should you do in the ADO.NET Entity Framework Designer?

A.
Add a new entity that has a base class of Product that is mapped to the stored procedure.

B.
Add a stored procedure mapping for the Product entity type.

C.
Add a complex type named Product that is mapped to the stored procedure.

D.
Add a function import for the Product entity type.

Explanation:
The ObjectContext class exposes a SaveChanges method that triggers updates to the underlying database.
By default, these updates use SQL statements that are automatically generated, but the updates can use stored procedures that you specify.
The good news is that the application code you use to create, update, and delete entities is the same whether or not you use stored procedures to update the database.
To map stored procedures to entities, in the Entity Framework designer, right-click the entity and choose Stored Procedure Mapping.
In the Mapping Details window assign a stored procedure for insert, update, and delete.

CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Mapping Stored Procedures(page 387-388)

Stored Procedures in the Entity Framework
(http://msdn.microsoft.com/en-us/data/gg699321)



Leave a Reply 0

Your email address will not be published. Required fields are marked *