Parameters are variables that are defined outside Entity SQL, usually through a binding API that is used by a host language. Each parameter has a name and a type. Parameter names are defined in query expressions with the at (@) symbol as a prefix. This disambiguates them from the names of properties or other names that are defined in the query.
The host-language binding API provides APIs for binding parameters.

Example
Named Parameters
var esql = @"select e from Employees as e
         where e.FirstName = @f and e.LastName = @l";
var q = db.CreateQuery(esql, new ObjectParameter("l", "mak"), new ObjectParameter("f", "mike"));
Ordered Parameters
The parameter names can be consecutive numbers and then pass the paramter values in order.
var esql = @"select e from Employees as e
         where e.FirstName = @0 and e.LastName = @1";
var q = db.CreateQuery(esql, "mike", "mak");

Last edited Mar 7, 2013 at 10:52 AM by ansiboy, version 2

Comments

No comments yet.