Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1095433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:07:24+00:00 2026-05-17T00:07:24+00:00

Recently I read in an article that the Approach 1 following is more preferred/advantagious

  • 0

Recently I read in an article that the Approach 1 following is more preferred/advantagious than Approach 2, while designing OperationContracts in WCF.

Approach 1

[OperationContract()]
ResponseMessageType SomeOperation1 (RequestMessageType reqMessage);

Approach 2

[OperationContract()]
string SomeOperation2 (string parm1, string parm2);

I can understand that any future change in the list of parameters/ type of any parameter, return type will be done just within the Message Contract (RequestMessageType and ResponseMessageType).

But I can’t realize how does it become an advantage?

If there are any changes intended, somewhere it has to be done; what’s going to be the difference if we do it in the Operation Contract or Message Contract.

I would like to understand and realize the advantages of the First approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:07:25+00:00Added an answer on May 17, 2026 at 12:07 am

    I think the advantage of doing it in the data contract is that it’s easier to modify an existing data contract without breaking compatibility with older clients.

    Suppose you want to return additional information to the caller. Using a data contract that’s easy, just add an additional field. Older clients will just ignore it. And if you want new clients to be able to talk to old servers, just make the field optional.

    I wouldn’t know how to do that in the service contract, without introducing a new service contract or at least a new operation contract. The implementation would not be much more difficult, but it would clutter the interface more.

    So you have “flexible” data contracts (with maybe many optional fields) vs. service contracts that are cluttered with redundant operations.

    It’s a compromise, but I favor the “flexible” data contract for most situations.

    The exception would be if you control both the client and the server, and can easily assure that every client will be up to date. In that case just modify (and ideally rename) whatever contract you like, and drop support for the old ones.

    BTW: the other direction is pretty much similar. You can also include additional (optional) fields in a data contract that the client sends to the server. Maybe new clients want to add some hints that can speed up processing. Or add additional data that’s not necessary to complete some operation, but which the server can store in a log to help troubleshooting or whatever.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently i read an article is about prevent brute-force attack. It said that automatically
I have recently read an article that said, that you should never trust user
Recently read in a article on dotnetpearls.com here saying that static ctors take a
I recently read an article that talked about the computation complexity of algorithms. The
I was wondering, I recently read an article that spoke of the ills of
I'm trying to improve my OOP skill. Recently, I've read an article that has
I read recently, in an article on game programming written in 1996, that using
I read an article recently regarding creating task based WCF service references in this
I recently read an article about password hashing . How are MD5 or SHA1
I recently read an article about c#-5 and new & nice asynchronous programming features

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.