70-516 · Question #174
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…
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…
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,
How the community answered
(36 responses)- A83% (30)
- B3% (1)
- C6% (2)
- D8% (3)
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
Topics
Community Discussion
No community discussion yet for this question.