WCF Data Border Design

It is rather a design issue:

lets say that I have some internal definitions of types that I absolutely want to keep secret (not subject to my consumers of services. However, I need to exchange data with users of the service. Some of the types that I want to share with users are exactly like that same as internal, while others are a simplified version of the internal type. Whether the same object or not - my main problem is that the internal object will never be exposed to the outside world, my secondary the problem now is doing too much duplicate code ...

The idea is that I really don't want to have a situation where the internal object will be exposed to WCF by mistake (this just happened to me for the internal object not even marked as [DataContract] ), so I thought about the following:

  • Create My WCF service contracts that do not have a reference to the internal type namespace. - this will provide some better security.

  • Introduce translations between internal types and corresponding public presentation objects in the service implementation code .

Is this the right approach? are there any well-known patterns that better solve the above problems?

Thanks a lot, Ofer

+3
source share
2

. , , DTO , .

, .

, .

+1

-, , . , / , :

  • , , , . , .
  • , , .

, . , , " ". , , .

(, , , ), , . - DTO ( ) - , , , . . . .

, , . , .

!

+1

Source: https://habr.com/ru/post/1759789/


All Articles