When should I use datacontract and when messagecontract in WCF

On what basis should we decide whether we need to create a dataContract or MessageContract for my WCF services.

I know that when we need more control over SOAP, we use MessageContract.

Secondly, I saw some code in which a DataContract is displayed through MessageContract.Whats its use.

Please provide some real life scenarios.

+3
source share
2 answers

This is not an "either-or" question. You will always have data contracts if you are dealing with composite data (more than just the basic types int, string, etc.). This is a given.

, SOAP. , 90% - .

, ( DataContracts) SOAP SOAP.

, , , , SOAP , . , .

, : , ( ).

+4

SOAP, MessageContracts. , , , .

( , ): http://msdn.microsoft.com/en-us/library/ms730255.aspx

DTO , DataContracts.

+3

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


All Articles