I inherited this code from a developer who left last week. His code is based on the article:
"Restful WCF / EF POCO / UnitOfWork / Repository / MEF".
This method works (when I browse to http://myapp/myservice/Returns):
[WebGet(UriTemplate = "Returns")]
public IQueryable<ReturnSnapshot> GetReturnSnapshots()
{
using (UnitOfWork)
{
ReturnSnapshotsRepository.EnrolInUnitOfWork(UnitOfWork);
return ReturnSnapshotsRepository.FindAll().ToList().AsQueryable();
}
}
but won't the ToList()
will cause the whole table to be pulled from the repository? We'll have 500K+ rows in production.
I thought I could change the last line to this:
return ReturnSnapshotsRepository.FindAll();
as FindAll
returns IQueryable. However, my change breaks the service, which now craps out with an HTTP 12152 error.
What should I be doing?