Adding methods to DataContract objects for WCF

后端 未结 4 1801
名媛妹妹
名媛妹妹 2020-12-06 08:20

Are DataContracts in WCF nothing more than DTOs? I was reading up about WCF and just had a couple of thoughts. It would be nice if some of the DataContract objects could hav

4条回答
  •  鱼传尺愫
    2020-12-06 09:02

    WCF at its core is a message-based system: your client proxy catches the call to a method, wraps up the method and all its parameters into a serialized message, and send that across the network to the service to be processed.

    So yes - in the end, all that goes from client to server in WCF is a serialized message - typically in XML format. You cannot serialize behavior or methods with this approach.

提交回复
热议问题