Sends for the fellow dear visitors:
Welcome to DongPad!
IQueryable is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries). As with all powerful features, you want to be careful with how you use it and make sure it is not abused. It is important to recognize that returning an IQueryable result from your repository enables calling code to append on chained operator methods to it, and so participate in the ultimate query execution. If you do not want to provide calling code this ability, then you should return back IList, List or IEnumerable results - which contain the results of a query that has already executed. For pagination scenarios this would require you to push the actual data pagination logic into the repository method being called. In this scenario we might update our FindUpcomingDinners() finder method to have a signature that either returned a PaginatedList: PaginatedList< Dinner> FindUpcomingDinners(int pageIndex, int pageSize) { } Or return back an IList, and use a “totalCount” out param to return the total count of Dinners: IList FindUpcomingDinners(int pageIndex, int pageSize, out int totalCount) { }
From the NerdDiner Pro!
Tags: DongPad
Powered By DongPad CopyRight 2008-2009, xhtml | css
Processed in 0.046 seconds(s) , 沪ICP备08111450号