我有一个repository类,它将我的LINQ打包为SQL数据上下文.repository类是一个包含所有数据层逻辑(以及缓存等)的业务线类.
这是我的回购接口v1.
public interface ILocationRepository
{
IList<Location> FindAll();
IList<Location> FindForState(State state);
IList<Location> FindForPostCode(string postCode);
}
但为了处理FindAll的分页,我正在考虑是否公开IQueryable<;ILocation>;而不是IList,以简化分页等情况下的接口.
从数据回购中公开IQueryable的利弊是什么?
非常感谢您的帮助.