我有一个将我的 LINQ to SQL Data Context 包装起来的存储库类。存储库类是包含所有数据层逻辑(以及缓存等)的业务线类。
这是我的 repo 界面的 v1。
public interface ILocationRepository
{
IList<Location> FindAll();
IList<Location> FindForState(State state);
IList<Location> FindForPostCode(string postCode);
}
但是为了处理 FindAll 的分页,我正在讨论是否公开 IQueryable<ILocation> 而不是 IList 以简化分页等情况的接口。
从数据仓库中公开 IQueryable 的优缺点是什么?
很感谢任何形式的帮助。