This code is a no-go
var errors = (from error in db.ELMAH_Error
select new
{
error.Application,
error.Host,
error.Type,
error.Source,
error.Message,
error.User,
error.StatusCode,
error.TimeUtc
}).ToList();
return View(errors);
as it results in a 'requires a model of type IEnumerable' error. The following code of course works fine, but selects all the columns, some of which I'm simply not interested in:
var errors = (from error in db.ELMAH_Error
select error).ToList();
return View(errors);
I'm brand spanking new to MVC2 + L2E, so maybe I'm just not thinking in the right mindset yet, but this seems counter-intuitive. Is there an easy way to select a limited number of columns, or is this just part of using an ORM?