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 6341569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:03:47+00:00 2026-05-24T20:03:47+00:00

I have a datacontract called Customer and have 2 OperationContract contracts like CreateCustomer() and

  • 0

I have a datacontract called Customer and have 2 OperationContract contracts like CreateCustomer() and UpdateCustomer() which takes Customer as data contract.

Now, i need to hide some of the properties of Customer datacontract in UpdateCustomer(). For example, there is a property called SSN in Customer data contract. This property should be visible in CreateCustomer() and should not be available in UpdateCustomer() for updation. Any idea, how to do it ?

Do we need to have seperate data contract object for both OperationContract?

Thanks in advance!
Bala

  • 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-24T20:03:49+00:00Added an answer on May 24, 2026 at 8:03 pm

    You would need two separate classes, one for the UpdateCustomer call that contains only those properties that call should see, and another for the CreateCustomer call with all of this (this can inherit from the previous class, obviuosly):

    [DataContract]
    public class UpdateCustomerData
    {
      ... have the common data properties here in this clas....
    }
    
    [DataContract]
    public class CreateCustomerData : UpdateCustomerData
    {
       [DataMember]
       public string SSN  { get; set; }
       .....
    }
    

    And then your calls need to take those classes:

    [ServiceContract]
    public interface IMyService
    {
       [OperationContract]
       public int CreateCustomer(CreateCustomerData customer);    
    
       [OperationContract]
       public int UpdateCustomer(UpdateCustomerData customer);    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight Project which passes data using the Data Contract to a
I have a [DataContract] called ReportRequest with a NOT NULL column 'SubmittedAt'. So my
I have a class that is marked with DataContract attributes and I would like
I'm trying to implement a service contract that contains a method which takes a
I need to initialize private readonly field after Deserialization. I have folowing DataContract: [DataContract]
I have a DataContract which I use as a return type from a WCF
I have a a datacontract which has important attributes on. For example, in the
I have a wcf web service which is configured for JSON. But my data
I have few different applications among which I'd like to share a C# enum.
I am having multiple Services in my application.i have a datacontract that i need

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.