我在 simple.data 中有这个查询
var db = Database.Open();
IEnumerable<Guid> recetas = db.Factura
.All()
.Where(db.Factura.ObraSocialPlan_id == obraSocialPlanId)
.Select(db.Factura.Id)
.Cast<Guid>();
我得到了
Cannot implicitly convert type
'Simple.Data.SimpleRecord'
to'System.Guid'
我应该如何更改查询?
最佳答案
您不能对可枚举对象执行此操作,但您可以将其具体化为如下列表:
var db = Database.Open();
IEnumerable<Guid> recetas = db.Factura
.All()
.Where(db.Factura.ObraSocialPlan_id == obraSocialPlanId)
.Select(db.Factura.Id)
.ToScalarList<Guid>();
如果你想要偷懒,这样你就可以在没有实际运行查询的情况下将可枚举传递到某个地方,请在 GitHub 页面上提出问题:http://github.com/markrendle/Simple.Data/issues
谢谢。
关于c# - 如何转换为 simple.data 中的 IEnumerable<Guid>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11375196/