What does the keyword "value" mean in this statement, and where would I go to learn more?
What happens if I leave out the keyword "value"? In the code below, z is an entity framework class.
string queryString = "SELECT VALUE q from x.zs as q where q.a = @parm;"
ObjectQuery<z> query = context.CreateQuery<z>
(queryString, new ObjectParameter("parmname",parmvalue));
return query.First();
(This is a part of a practice question for an exam).
The above code is in a function that returns a variable of type z.
Best Answer
That is Entity SQL syntax.
Value
keyword allows only one value to be specified, and does not add a row wrapper.Read article about SELECT statement in ESQL
So, if you want to materialize
z
object from your query, you should useSELECT VALUE
syntax (otherwise you will get exception: cast from MaterializedDataRecord to z type is not valid).Without
VALUE
keyword you will get set of rows: