Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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?
4.how to define ref and out parameter in message contract?
Posted 20-Aug-12 22:12pm
Edited 20-Aug-12 22:16pm
v2
Comments
Sergey Alexandrovich Kryukov at 21-Aug-12 3:32am
   
Who do you think prefers what? I don't :-)
--SA
Rate this: bad
good
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.
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[^]
  Permalink  
Rate this: bad
good
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 | :)
 
—SA
  Permalink  
Comments
bluesathish at 25-Apr-13 8:57am
   
This is not a solution buddy :-) @Sergey Alexandrovich Kryukov
Sergey Alexandrovich Kryukov at 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 at 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 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,142
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 25 Apr 2013
Copyright © CodeProject, 1999-2014
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