Usually when I query with Entity Framework I do something like the following:
using (var db = MyDataContext()){
db.MyTable.Select(d => new DataModel(){
Id = d.Id,
Name = d.Name
});
}
But sometimes I get an error at runtime "the entity or complex type 'DataModel' cannot be constructed in a linq to entities query". How can I know if a type can be constructed without running the program and testing?