Thursday, September 6, 2012

Issue: Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.

Issue:
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.

Solution:
Use .AsEnumerable() before .Select()

For example:
Table.Where(x=>...)
.AsEnumerable()
.Select(x=>...);

1 comment: