ADO.Net Entity Framework 的 Entity SQL 语言 入门

Entity SQL 是类似于 SQL 的、与存储无关的语言。Entity SQL 旨在基于 实体数据模型 (EDM) 查询和处理实体对象的多功能对象模型(方法接口)。

Entity SQL 关键字

Value

别名

ESQL 中 条件需要指定所属对象,否则会报找不到的错误。

string queryString = @"SELECT VALUE o FROM NorthwindEntities.Orders as o WHERE  o.OrderID = 10248 ";

注释

Entity SQL 查询可以包含注释。注释行以两个短划线 (--) 开头。
"SELECT VALUE c FROM NorthwindEntities.Customers as c  -- this a comment "

参数

参数是在esql之外定义的变量,每个参数都有名称和类型,参数名称在查询表达式中定义,并以@符号作为前缀。例如:

Select VALUE c from NorthwindEntities.Customers as c where c.CustomerID=@customerID

参考文章:

http://msdn.microsoft.com/zh-cn/library/bb399560.aspx

http://www.cnblogs.com/xray2005/category/189491.html 风车车

冯瑞涛
原文地址:https://www.cnblogs.com/finehappy/p/1685801.html