【发布时间】:2015-07-31 23:20:16
【问题描述】:
我在下面的查询中遇到错误,使用 EF + LINQ
var model = (from c in _db.Accounts
let geo = new GeoCoordinate(Convert.ToDouble(c.Latitude.Value), Convert.ToDouble(c.Longitude.Value))
where ((geo.GetDistanceTo(CurrentCoord) / 1000) < 3)
orderby c.Name
select new CompanyVM
{
Name = c.Name,
...
}).ToList();
运行时错误:
LINQ to Entities 仅支持无参数构造函数和初始化程序。
有人能解释为什么它失败了吗?
【问题讨论】:
标签: linq entity-framework