ʃʈɑɲ
ʃʈɑɲ

Reputation: 2684

How do I pass <summary> from ASP.net webservice?

I'm trying to document a webservice class to a C# application.

public class Container
    {

        private Dictionary<String, Object> _properties = new Dictionary<string, object>();

        private Boolean _changed;
        public Boolean Changed
        {
            get
            {
                return _changed;
            }
            set
            {
                _changed = value;
            }
        }

        // Human Readable fields

        public Object this[String Name]
        {
            get
            {
                if (_properties.ContainsKey(Name))
                    return _properties[Name];
                return null;
            }
            set
            {
                if (!_properties.ContainsKey(Name))
                    _properties.Add(Name, value);
                else
                {
                    _properties[Name] = value;
                    _changed = true;
                }
            }
        }

        #region Fields

        /// <summary>
        /// Field: RCPAKN
        /// </summary>
        public String ContainerNumber
        {
            get { return (String)this["RCPAKN"]; }
            set { this["RCPAKN"] = value; }
        }
...

You see: I try to pass <summary> information but this does not get picked up by the C# application calling the webservice. (not in Object Browser, not showing up during Intellisense...)

Yes, I've published the webservice and updated the webreference.. ;)

Is this not possible or do I have to add some parameters to the webservice?

Thank you

EDIT:

- webservice built using VS.Net 2010, consuming from VS.Net 2008 (CF3.5)
(the information does show in VS.Net 2010 Object Browser... IDE feature?)

Upvotes: 0

Views: 492

Answers (1)

fejesjoco
fejesjoco

Reputation: 11903

The XML documentation is not compiled into the code, so there's no way to use that inside the application, let alone through a webservice.

One possibility is to develop a custom Attribute (like DescriptionAttribute), and implement WSDL import/export extensions, but that's very difficult.

What I usually do is this. When I develop a service, I use WCF and I create a service interface with the [ServiceContract] attribute. I put XML documentation on the service methods. My actual WCF service implements this interface. I put this interface, along with the data classes, into a separate assembly. And I also put a WCF client into this assembly, which exposes this interface. In my consumer project, instead of adding a service reference, I add a regular assembly reference to this common assembly and use the WCF client from there, and this way, I can see the XML documentation in Visual Studio. Having a common service-client assembly like this is good practice IMHO, and seeing the documentation on "the other side" is a lucky side-effect.

Upvotes: 2

Related Questions