J'ai une méthode qui contient les éléments suivants Linq au code SQL:Lancer un type anonyme à un type connu
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;
}
Je reçois un incapable de lancer une erreur en essayant de lancer des « résultats » du type montré dans la déclaration de retour. Dois-je être capable de faire cela? Une entité L2SBusinessEntities.Report.MesReport se présente comme suit:
int MesReportID
int ParentID
string ReportTitle
string ReportName
string DatabaseServer
string DatabaseName
string Login
byte[] ReportFile
Ceci est très faux. – SLaks