title: WCF : Making methods in DataContract object accessible to web service clients
body: <p>Objects of the following class need to be passed as arguments to a WCF web service:</p>
  
  <pre><code>    public class Context
      {
          public static readonly string AUTH_CODE = "AUTH_CODE";
  
          public static readonly string REQUEST_TAG = "REQUEST_TAG";
  
          private readonly IDictionary&lt;string, string&gt; _context = new Dictionary&lt;string, string&gt;();
  
          public void AddProperty(string key, string value)
          {
              _context.Add(key, value);
          }
  
          public string GetProperty(string name)
          {
              return _context[name];
          }
      }
  </code></pre>
  
  <p>I tagged the class with [DataContract] and AUTH_CODE, REQUEST_TAG and _context fields with [DataMember]. The class itself is defined along with the web service on the server side.</p>
  
  <p><p>
  When I try to instantiate an object of this class so that I can pass it as parameter while calling the web service from the client, I observe the following:</p>
  
  <ol>
  <li>AUTH_CODE and REQUEST_TAG are not visible.</li>
  <li>_context is visbile though it is a privte member</li>
  <li>AddProperty an GetProperty methods are not visible</li>
  </ol>
  
  <p>Can you please explain the above behavior? </p>
  
  <p>Also, I would need access to AddProperty method to populate the object before calling the web service. How do I achieve this?</p>
  
  <p><strong>Note :</strong> This is my first experience with WCF. If I am straying off from any standard practices towards achieving such behavior, please advise.</p>