c# - WCF : Making methods in DataContract object accessible to web service clients -


objects of following class need passed arguments wcf web service:

    public class context     {         public static readonly string auth_code = "auth_code";          public static readonly string request_tag = "request_tag";          private readonly idictionary<string, string> _context = new dictionary<string, string>();          public void addproperty(string key, string value)         {             _context.add(key, value);         }          public string getproperty(string name)         {             return _context[name];         }     } 

i tagged class [datacontract] , auth_code, request_tag , _context fields [datamember]. class defined along web service on server side.

when try instantiate object of class can pass parameter while calling web service client, observe following:

  1. auth_code , request_tag not visible.
  2. _context visbile though privte member
  3. addproperty getproperty methods not visible

can please explain above behavior?

also, need access addproperty method populate object before calling web service. how achieve this?

note : first experience wcf. if straying off standard practices towards achieving such behavior, please advise.

  1. the datamemberattribute attribute ignored if applied static members.
  2. member accessibility levels (internal, private, protected, or public) not affect data contract in way.
  3. data contract supports state, not behaviour. methods not affect on data contract.

the behaviour of data contacts described in following msdn link: http://msdn.microsoft.com/en-us/library/ms733127.aspx