I'm having trouble understanding the nature of the exception generated when trying to execute this query against link to entities.
var internalUsersFromRepos = userRepos.Users.Where(u => u.IsInternalUser)
.OrderBy(u => u.SirName)
.Skip((int)((page - 1) * usersPerPage))
.Take((int)usersPerPage)
.Select(u => new { User = u, Count = userRepos.Users.Count() })
.ToList();
Unable to cast the type 'System.Data.Objects.ObjectQuery
1' to type 'System.Linq.IQueryable1'. LINQ to Entities only supports casting Entity Data Model primitive types.
If I replace "Count = userRepos.Users.Count()" with something constant like "Count = 3" then there is no exception so I believe this aspect of the query is key.