Click here to Skip to main content
11,922,641 members (57,788 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET WCF C#4.0
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? to define ref and out parameter in message contract?
Posted 20-Aug-12 22:12pm
Edited 20-Aug-12 22:16pm
Who do you think prefers what? I don't :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.[^][^]

Check the below link to know how to defin ref and out parameter in message contract.[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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. Smile | :)

bluesathish 25-Apr-13 8:57am
This is not a solution buddy :-) @Sergey Alexandrovich Kryukov
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. :-)

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. :-)
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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151125.1 | Last Updated 21 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100