Should I share types between a Web API service and its client ? What are the other options?

后端 未结 3 1333
南笙
南笙 2021-01-30 20:15

We are developing a Web API RESTful service to provide access to common data to all the applications of our enterprise. To help we will also publish a Client API that encapsulat

3条回答
  •  囚心锁ツ
    2021-01-30 21:08

    We had a similar discussion -- with similar pros and cons -- and we took a hybrid approach. We shared an assembly between the client and the server, but only shared interfaces. Then we created classes based on the interfaces on the client side. The advantage was that the actual objects on the client and the server could change independently.

提交回复
热议问题