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

  • Home
  • SEARCH
  • 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 431457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:58:37+00:00 2026-05-12T19:58:37+00:00

Looking for some guidance on a WCF service I’m prototyping. I have a WCF

  • 0

Looking for some guidance on a WCF service I’m prototyping.

I have a WCF service hosted in IIS that will pass data to my clients. I have a separate shared assembly that contains all my business objects that is referenced in my WCF project.

I want to have a few of the properties in these business objects read only as I don’t want my customers to be able to change these fields in their client code.

I read that decorating classes with the [DataContract] attribute enforces the proper serialization to maintain readonly fields but when I implement it the proxy classes generated in the client show as writable.

Are there any tricks to accomplish this?

Thanks!

/Eric

  • 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-12T19:58:37+00:00Added an answer on May 12, 2026 at 7:58 pm

    You can use regular properties, mark them with the DataMember attribute and make the set accessor private:

            [DataMember]
            public object IsFoo
            {
                get
                {
                   return _isFoo;
                }
                private set { }
            }
    

    EDIT: Also, to truly prevent users of your class from setting the property, you could always throw an InvalidOperation exception.

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

Sidebar

Related Questions

I have a common scenario that I am looking for some guidance from people
I am looking for some guidance. I have a data form field which I
Looking for some guidance on a wcf 4 rest service which is based on
Being a self-confessed newbie I'm looking for some advice and guidance :) I have
Hi guys looking for some guidance, i have a knowledge of xhtml, css, javascript,
Looking for some guidance on this issue (below is a parallel example): I have
Looking for some guidance. In my main window nib file, i have a tab
I’m looking for some guidance as to the best approach for processing data within
Not a great title but I'm looking more for some guidance, have searched quite
Looking for some guidance on the best way to implement this scenario: I have

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.