问题
One of by service contract passes a Huge DataSet
to the Client. I am using BufferedTranfer
mode.
In very rare cases I have more data to be send, because of this reason I am in a confusion to change the TransportMode to Streamed.
Is that good practice to use "DataSet"
for transfer data through NetTcpBinding
?
Any alternatives to DataSets
?
回答1:
Please, do not return datasets from a WCF service.
For information why see: Returning DataSets from WebServices is the Spawn of Satan and Represents All That Is Truly Evil in the World,
回答2:
In a 3tier application we do return DataSets from a WCF service layer, successfully and without hitting the performance (too much). Reason is: our entities of our SQL database can be changed via meta data at any time. A client can request the meta data information of an entity (columns, types, sizes, nullable etc).
A request to the service names the entity and retrieves the current setup of columns specified in the meta data as DataSet. This allows full flexibility which is not the case with a hard coded object model.
回答3:
Before sending data across platforms/network, it is advisable for them to be serialized and even encrypted for secure reasons into some sort of formats, and XML seems most promising for large chunks of data. I hear it works better but I never try it myself.
来源:https://stackoverflow.com/questions/11790309/wcf-is-that-good-to-use-dataset-for-transferring-data-through-nettcpbinding