Code:
public static IEnumerable<TableRowModel> GetRows()
{
var to_ret = db.TableRows.select(x=> new TableRowModel(){
TableRowId = x.TableRowId,
Type = x.Type,
Name = x.Name,
CreatedAt = x.CreatedAt,
ModifiedAt = x.ModifiedAt,
Enums = x.Enums.Select(y => y.ToEnumModel()),
});
return to_ret;
}
public static EnumModel ToEnumModel(this Enum x)
{
var to_ret = new EnumModel()
{
CFPId = x.CFPId,
CreatedAt = x.CreatedAt,
ModifiedAt = x.ModifiedAt,
};
return to_ret;
}
I get the following error when using the GetRows
method:
LINQ to Entities does not recognize the method
Given the error, it's understood that LINQ To Entities
is not able to recognize the extension method ToEnumModel
.
I would like to know if there is a way around this?
So that I would not be repeating ToEnumModel
code again in GetRows
extension.
>(queryResults);`
– juharr Oct 23 '17 at 17:59