I'm getting this error "The entity or complex type cannot be constructed in a LINQ to Entities query.".
Why can't I use this code below?
public IList<Model> GetTherapist()
{
return (from t in dbContext.Table1
select new Model() {
Id = t.Id,
Name = t.Name
}).ToList();
}
-----
Do we really have to do like that?
public IList<Model> GetTherapist()
{
return (from t in ((from t1 in dbContext.Table1
select t1 ).ToList())
select new Model() {
Id = t.Id,
Name = t.Name
}).ToList();
}
Michael Sync: blog: http://michaelsync.net