I've been using linq2sql on a few projects, but i decided it was time to try out EF as its supposed to be more powerful and better. There are a few things that is really annoying tho. One of them is projecting a result into a list, this works well in l2sql but not in EF.
public class bo.Transaction
{
public long Id { get; set; }
public List<bo.Line> Lines { get; set; }
}
public class bo.Line
{
public int RowNo { get; set; }
public string Descripton{ get; set; }
public double Amount{ get; set; }
}
return from t in Db.Transaction.Include("Lines")
select new bo.Transaction {
Id = t.Id,
Lines = t.Lines.OrderBy(l => l.RowNo).ToList(),
};
The ToList() call fails however, with a message "System.NotSupportedException: LINQ to Entities does not recognize the method 'List[bo.Line] ToListLine' method, and this method cannot be translated into a store expression..".
Any way to get around this? Or do i just have to use ienumerable instead of lists?