var codeFirstRepositor = new Donors();
var list = codeFirstRepositor.CampaignReps.Select(c => c).ToList();
CampaignRep
类构造函数中放置一个断点时,它根本就没有被调用 - 异常似乎发生在对象实例化之前public class Donors : DbContext
{
public Donors()
{
// Needed for WCF serialization to work
Configuration.ProxyCreationEnabled = false;
}
public DbSet<CampaignRep> CampaignReps { get; set; }
}
'CampaignsReps' is not a member of Transient.collection[MyNameSpace.Donor(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a subquery to iterate over the collection. Near escaped identifier, line 1, column 10.
此错误的原因是什么?
答案 0 :(得分:1)
删除选择(c =&gt; c)并重试。另外,为什么你的查询中有这个呢?