我使用的是 Windows phone 8、MVVM + SQL Server CE 3.5 数据库
在文件夹model
中,我有一个表声明<TblCollections>
在文件夹ViewModel
中有此代码用于获取集合。
public IEnumerable<TblCollections> GetTblCollections()
{
using (DbContext db = new DbContext(DbContext.ConnectionString))
{
var query = from collection in db.TblCollections
select new TblCollections
{
a = (string)collection.a,
b = (int)collection.b,
id = (int)collection.id,
};
IEnumerable<TblCollections> _TblCollections = query.ToList();
return _TblCollections;
}
}
我收到错误query.ToList();
不允许在查询中显式构造实体类型“TblCollections”
为什么?