locked
Attribute setting for DSS proxy generation RRS feed

  • Question

  • Hi,

    I want to define a class in my DSS service that I want to be directly copied to the proxy library. I do not want the proxy to make it serializable. The purpose of this class is to act as a base class for other services to use. Can you please let me know what attribute should I annotate the class with. If I mark it as a DataContract, then only the serialization code for all the DataMember fields are getting generated. Hence, I cannot use it. I do not see any other attribute that seems to fit my requirement.

    [/*What should be the attribute here so that the class is copied as such*/] public class ClassA { protected int A

    }

    In the above example, if I put [DataContract], the protected member of "A" of ClassA does not get copied and the classA is made DSS serializable. The [DataContract(ExcludeFromProxy = true)] option also does not seem to work.

    Please help me.

    Thanks,

    Venkat

    Saturday, September 22, 2012 10:48 AM
    Moderator

Answers

All replies

  • You cannot have protected members serialized or represented in proxies. They need to be public.

    [DataContract]

    public class ClassA
    {

        [DataMember]
        public
    int A;

    }

    Monday, September 24, 2012 7:35 PM
    Moderator
  • Hi Harshavardhana Kikkeri,

    Thank you for your time and reply. I am aware I cannot have protected members for classes that are made DSS serializable by the proxy. I do not want ClassA to be serialized by DSS proxy. I want ClassA to be copied as such in the .cs proxy file.

    Thanks,

    Venkat

    Monday, September 24, 2012 9:31 PM
    Moderator
  • You can just create a pre-build or post build script which copies the .cs file to the proxy folder.

    Please refer to the information in the following link

    http://msdn.microsoft.com/en-us/library/ke5z92ks.aspx

    Saturday, September 29, 2012 12:03 AM
    Moderator
  • Thank you Harshavardhana for the information !!!
    Sunday, September 30, 2012 3:34 AM
    Moderator