I use a Windows phone 8, MVVM + SQL Server CE 3.5 database
In folder model
I have a declaration of table <TblCollections>
In folder ViewModel
have this code for getting the collection.
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;
}
}
I receive error on query.ToList();
Explicit construction of entity type "TblCollections" in query is not allowed
Why?