I would support ozczecho - why would you ever want to return 10M records? Will your customers REALLY want to sift through 10M orders?? I highly doubt it....
Limit the number - by e.g. date ranges (all orders from 1Q/09), or by any other criteria. Just because you could return 10M rows doesn't mean it'll really be a good idea.
Also, together with SQL Server, you could easily implement paging, e.g. you could have your WCF service send back the first e.g. 100 rows, and send back a flag indicating there's more, and then have your client request rows 101 through 200 etc. It takes a bit of logic, but it would make communication just THAT much easier (and quicker)!
Also, in WCF, you have to define maximum message sizes - they're normally at 64K. The reason for this is the fact that a message needs to be assembled in memory, in full, before being able to be transmitted. Imagine you have 50 clients hitting your server - how much memory can you really set aside for "message assembly" on your server?
Marc
UPDATE:
One way you can achieve paging in a service would be by having a call something like this:
[OperationContract]
public List<Orders> GetOrders(string searchCriteria, string sortExpression,
int skipFirstRows, int takeRows)
This is inspired by the .Skip() and .Take() extension methods introduced by LINQ.
In this case, you could call GetOrders and define some search criteria (that might be a class, too, instead of just a string) to match your orders, you can define how to sort the orders by specifying sortExpression
, and then you tell the service that you want to skip the first n rows and then take x rows.
So a call
List<Orders> result = GetOrders(criteria, sort, 0, 50)
would fetch the first 50 rows. Once you're done, you can call again:
List<Orders> result = GetOrders(criteria, sort, 50, 50)
and now you'd skip the first 50 rows (which you've already displayed / reported on) and then you take the next 50 (rows 51-100).
Of course, if your WCF service on the backend uses LINQ, you can translate that directly into calls to .Skip() and .Take() on your LINQ queries! :-)
UPDATE 2:
Are you working against SQL Server 2005 or higher? Check out the Common Table Expressions (CTE) which are basically the basis for what LINQ does. This allows you to define "virtual" view on your data and select only a certain section of the data set.
See more information here: