Code:
public static 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.AsExpandable().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;
}
Running GetRows
gives error saying:
LINQ to Entities does not recognize the method 'System.Linq.IQueryable1[Test.Models.Enum]
AsExpandable[Enum]
(System.Linq.IQueryable1[Test.Models.Enum])' method, and this method cannot be translated into a store expression.
Even tried putting AsExpandable
like db.TableRows.AsExpandable().Select
. Doesn't work.