当我使用Where子句(LINQ)时,结果集返回空,我收到错误“枚举没有产生结果”。可能有什么问题?
public class Stores
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int StoreId { get; set; }
public string StoreName { get; set; }
public string Address { get; set; }
public string Telephone { get; set; }
public int TownId { get; set; }
}
public DbSet<Stores> Store { get; set; }
var storeList = from n in db.Store
where n.TownId == 10
select n;