【发布时间】:2011-02-23 09:37:06
【问题描述】:
我使用的是 EF(edmx 不是代码优先),我想将 sp 加入“普通”表,所以我使用以下 linq 查询:
var test = (from obj1 in e.myTable
join obj2 in e.MySp(aString) on obj1.AStringProperty equals obj2.AStringProperty
select r.description).ToList();
然后引发 NotsupportedException 并显示以下消息:
Unable to create a constant value of type 'Api.DataAccess.Contexts.MySp_Result'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
但是我用来连接的所有属性都是一个字符串,所以我唯一可以假设的是,由 sp 返回的生成对象有一个int? 和一个long? 会导致这个错误?如果是这样,我该如何解决?
谢谢
【问题讨论】:
标签: c# .net linq entity-framework linq-to-entities