Is DataContract attributes required for WCF

前端 未结 4 1408
情书的邮戳
情书的邮戳 2020-11-30 06:04

I\'m writing WCF service and his client. I want to send/receive objects of my custom classes, between service and client.

I have 3 modules

  • WCF service
4条回答
  •  情深已故
    2020-11-30 06:30

    It's not required to use DataContract attributes, your service will work just fine without them.

    Having said that, I really don't think having your service and client share a class library is the best design approach. It would be a lot clearer if you'd expose your types through DataContracts.

    What would happen when someday, someone wants to consume your service but don't have access to the shared class library?

提交回复
热议问题