Description
I am not using Entity Framework, since I do not want to couple my resource model to the underlying data model. As such, I am implementing a custom IResourceRepository<TResource>
.
The IResourceRepository
essentially allows you to compose up an IQueryable
, applying filters, and sorts, to the underlying data source. Each method takes an IQueryable, and then returns an IQueryable. However: I do not intend to actually use this IQueryable as the final result. I would like the ToListAsync
method to have a different return type.
The IQueryable
can be used to compose up EF Core operations, like filters, or whatever, but then the final transformation of the data into a Resource
should allow me to transform the IQueryable
. Essentially, the IQueryable should not necessarily be the TResource
type. I think it would make more sense if the interface was instead IResourceRepository<TResource, TQueryable>
. That way each of the composition methods (Get
, Include
, etc) would shape the IQueryable, but the final ToListAsync
method could transform that into the actual resource type.
Thoughts?