Which method should you call?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You
manually create your own Context class named AdventureWorksDB that inherits from Object
Context. You need to use Adventure WorksDB to invoke a stored procedure that is defined in the
data source. Which method should you call?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. You
manually create your own Context class named AdventureWorksDB that inherits from Object
Context. You need to use Adventure WorksDB to invoke a stored procedure that is defined in the
data source. Which method should you call?

A.
Translate

B.
ExecuteFunction

C.
ExecuteStoreQuery

D.
ExecuteStoreCommand

Explanation:
ExecuteFunction(String, ObjectParameter[]) Executes a stored procedure or function that is defined
in the data source and expressed in the conceptual model;
discards any results returned from the function; and returns the number of rows affected by the
execution.
ExecuteStoreCommand() Executes an arbitrary command directly against the data source using the
existing connection.
ExecuteStoreQuery<TElement>(String, Object[]) Executes a query directly against the data source
that returns a sequence of typed results.
Translate<TElement>(DbDataReader) Translates a DbDataReader that contains rows of entity data to
objects of the requested entity type.
ObjectContext.ExecuteFunction Method
(http://msdn.microsoft.com/en-us/library/dd986915.aspx)



Leave a Reply 0

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