IEnumerable<type> as service data result

in ASP.net API, i have below collection need to return from server:

    public IEnumerable<Customer> getCustomerList(string customer, string userCode, string SalesPerson)
    {
       .......
    }

in RemObject Service Builder, i have create a struct ‘Customer’. i need to return IEnumerable in new create services data. how to do this ?

Thanks.

Hello

It is not possible to define method or data structure that uses a IEnumerable data type. The only data type you can use is an array. This limitation exists because IEnumerable is specific for .NET and is not available in, say, JavaScript or Object C, while array type is afailable on all supported platforms.

However please note that in .NET 2.0+ array type Customer[] implements interface IEnumerable .

An workaround (not recommended to use) is to directly modify the _Intf file and replace Customer[] with IEnumerable in the service interface definition. This would work until the service .RODL is modified and the _Intf file is regenerated.

Regards

Message noted well. But even though i use IEnumerable in server to return data, when the client consume the service still get the JSON / XML data and the client will use their way to translate back to the data what they want, right ?

just to check if i need to return a list of record eg CustomerList, est 4000+ record to client, in server i need to loop the dataset and one by one put into array and send the array back, right ?

Thanks for your suggestion.

Hello

You would have to do this anyway. Setting IEnumerable as a result type wouldn’t imply some magic that would allow to load data from the server one item at a time (and even if it would the result would be unusable due to delays related to network interactions).
So you need to either process these 4000+ records server-side or to put them into an array and send them back to the client in one package or to introduce some kind of result pagination.

Regards