passing class or datareader via webservice
I have a broad question about Web Serv开发者_JS百科ices and SOA. I have a database that contains data I would like to expose for reading (just reading, no inserts or updates). Is it best to expose the data as a class or is it best to expose the information as a datareader?
You can't expose data reader over web service. You have to execute reader, fill data to objects and send those objects.
Check WCF Data services. It will save you a lot of work.
I think the DataReader is not serializable. It's better to return the result as list of objects or you may fill a DataTable and return it.
精彩评论