Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi Guys,

What is advantage of using message contract when we already have data contract for exchanging parameter with service.Instead of using message contract we can use dataset.
1.Why we prefer message contract over data contract?
2.why we use message contract instead of dataset?
3.when to go for message contract?
4.how to define ref and out parameter in message contract?
Posted
Updated 20-Aug-12 21:16pm
v2
Comments
Sergey Alexandrovich Kryukov 21-Aug-12 3:32am    
Who do you think prefers what? I don't :-)
--SA

DataContracts are used to descibe the data types used by a service. Interoperability is possible through this since it uses metadata of the services in background.DataContracts can be used to describe either parameters or return values.

MessageContracts are used for the SOAP formats. We can have message header and other elements over here

Check this link to know why we have to use message contract.
http://izlooite.blogspot.in/2010/01/wcf-why-use-messagecontract-when.html[^]

http://wcftutorial.net/Message-Contract.aspx[^]

Check the below link to know how to defin ref and out parameter in message contract.
http://www.diranieh.com/net_wcf/serialization.htm[^]
 
Share this answer
 
This question is exactly the same as asking "What is the advantage of the motor over the gear box". As well as your question, it does not make sense: the car won't go. :-)

—SA
 
Share this answer
 
Comments
bluesathish 25-Apr-13 8:57am    
This is not a solution buddy :-) @Sergey Alexandrovich Kryukov
Sergey Alexandrovich Kryukov 25-Apr-13 9:25am    
It depends on what you call a solution. A "solution" of the non-existing or incorrectly formulated problem, like in this case, is not a well-defined notion. So, in practical terms, the best solution is to help the inquirer to clean up the brain. And worse solution, actually a harm, would be an attempt to provide some real information on related topics, because it would only create an illusion of understanding and encourage sloppy or wrong thinking.

I hope you understand it after my explanation. :-)

—SA
bluesathish 25-Apr-13 10:09am    
OfCourse you're right, you should probably post that in the comment section rather than the solution. Thats what i'm commenting like that. :-) @SA.
Sergey Alexandrovich Kryukov 25-Apr-13 10:57am    
Thank you for your understanding. In most cases, this is what I do, but in this case, I just wanted to expose my point a bit more, as I hoped the aphoristic form could be pretty convincing and entertaining. I thought it would not be a big sin. :-)
—SA
bluesathish 30-Apr-13 1:39am    
Hi Sergey, I've posted the following question 4 days before, but still i didn't got any responses, will you help me? link is below http://www.codeproject.com/Questions/583411/HostingplusWindowsplusWCFplusServiceplusinplusIISp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900