"Only parameterless constructors and initializers are supported in LINQ to Entities."
Le code qui déclenche cette erreur est le suivant :
var events = (from c in _articleRepository.FindEvenementArticles()
orderby c.DatePublication descending
select new ArticleDto(c)
).Take(10);
une correction possible :
var events = (from c in _articleRepository.FindEvenementArticles()
orderby c.DatePublication descending
select new ArticleDto()
{
Id = c.IdArticle,
ContenuHtml = c.ContenuHTML
}
).Take(10);
une autre correction possible :
var retList = new IEnumerable
var events = (from c in _articleRepository.FindEvenementArticles()
orderby c.DatePublication descending
select c
).Take(10);
foreach (var e in events)
{
retList.Add(new ArticleDto(e);
}