I have a method that contains the following Linq to SQL code:
public List<L2SBusinessEntities.Report.MesReport> GetListForReportTree(MESProductionDatabase database)
{
byte[] byteArray = new byte[1];
var results =
from report in database.MesReport
select new { report.MesReportID,
report.ParentID,
report.ReportTitle,
report.ReportName,
report.DatabaseServer,
report.DatabaseName,
report.Login,
ReportFile = byteArray };
return (List<L2SBusinessEntities.Report.MesReport>)results;
}
I'm getting an unable to cast error in trying to cast 'results' to the type shown in the return statement. Should I be able to do this? An L2SBusinessEntities.Report.MesReport entity looks as follows:
int MesReportID
int ParentID
string ReportTitle
string ReportName
string DatabaseServer
string DatabaseName
string Login
byte[] ReportFile