nerdexam
Microsoft

70-516 · Question #174

70-516 Question #174: Real Exam Question with Answer & Explanation

The correct answer is A. var prods = ctx.CreateQuery<Product>(prodQuery,. CreateQuery<T>-Creates an ObjectQuery<T> in the current object context by using the specified ExecuteStoreCommand-Executes an arbitrary command directly against the data source using the existing connection. ExecuteFunction(String, ObjectParameter[])-Executes a stored procedure o

Question

You use Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. The application defines the following Entity SQL (ESQL) query, which must be executed against the mode. string prodQuery = "select value p from Products as p where p.ProductCategory.Name = @p0′′; You need to execute the query. Which code segment should you use?

Options

  • Avar prods = ctx.CreateQuery<Product>(prodQuery,
  • Bvar prods = ctx.ExecuteStoreCommand(prodQuery,
  • Cvar prods = ctx.ExecuteFunction<Product>(prodQuery,
  • Dvar prods = ctx.ExecuteStoreQuery<Product>(prodQuery,

Explanation

CreateQuery<T>-Creates an ObjectQuery<T> in the current object context by using the specified ExecuteStoreCommand-Executes an arbitrary command directly against the data source using the existing connection. 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. ExecuteStoreQuery<TElement>(String, Object[])-Executes a query directly against the data source that returns a sequence of typed results. ObjectContext.CreateQuery<T> Method

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice