I'm developing an WCF Data Service and I wanted to use the SetEntitySetPageSize (allows server paging) and the MaxResultsPerCollection (sets the max # of rows returned) 开发者_如何学JAVAtogether.
Unfortunately, you can't. My question is why? Perhaps I'm missing something. I figured this would/could be a good idea depending on someone's situation? Is it because we want an OData feed to be able to return everything?
What happens when you want to consume it with a Silverlight app or web app. If the user doesn't limit the results themselves they could be in for a large resultset.... Perhaps that's the point. End user beware...?
Both of these settings are a security/performance feature on the server. The MaxResultsPerCollection causes the server to fail the request if the limit is overrun. The SetEntitySetPageSize allows the server to return only a small part of the data, leaving it up to the client to ask for more if needs to do so. Other than really malicious clients who would bombard your server with many "get me next page" requests, the SetEntitySetPageSize is pretty much superior to the MaxResultsPerCollection. And there are easier ways to make your server suffer if it accepts unlimited number of requests for the client. As to your last question, I think that's actually a good thing that it's up to the client. Some clients might be able/want to handle all the data, no matter how large. Those who don't can stop at any time. Maybe if you could describe the scenario in which you think you would need both...
精彩评论