LINQ where子句不返回结果

时间:2013-05-03 09:02:54

标签: asp.net-mvc linq where-clause enumeration dbset

当我使用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;

0 个答案:

没有答案