I read Repositories should NOT utilize IQueryable. Simple repository example have ListAll, FindById, Add, Delete. Below is a sample Product Repository ListAll. If I cannot overlay queries, and require searching queries eg, ProductTable by Category, or ProductTable by Weight (intricate queries), I will then require a DAO (Data Access Object Pattern).
So question is,
(a) is it okay to have a Repository Pattern and DAO Pattern in same application?
(b) Doesn't this bypass the whole point of having a DDD Repository Pattern?
How would I access ProductTable having Intriciate requests while still going through repository? The first Repository query will be slow.
public virtual IEnumerable<Products> List()
{
return _dbContext.Products.AsEnumerable();
}
// This repository pattern will be slow, first it access all product and Then filters
var result = context.products()
.Where(o => o.ProductCategoryId== 5);
// This is dao pattern, with more specific queries
var result = context.products.AsEnumerable()
.Where(o => o.ProductCategoryId== 5);
Entity Framework Repository Pattern why not return Iqueryable?