Create Annotation for XSD
I have a relatively complex schema that was converted into a DataContract. In doing so, I lost the ability to do somethings like constraints, which I will have to do in Business logic. I would like to convey the constraints to the end consumer through the use of annotation.
Is there any way to annotate the XSD that is being generated? I would like to do something like the following and have it show in the schema.
Thanks,
Dave
[DataContract] public class Person { private string _firstName; private string _lastName; public Person() { } public Person( string first, string last ) { this._firstName = first; this._lastName = last; } [DataMember(Annotation="This is the first name of the person.")] public string FirstName { get { return ( _firstName ); } set { _firstName = value; } } [DataMember(Annotation="This is the last name of the person.")] public string LastName { get { return ( _lastName ); } set { _lastName = value; } } }
Answers
- This feature is unfortunately not available for DataContracts in WCF v1.
Cheers,
All Replies
- This feature is unfortunately not available for DataContracts in WCF v1.
Cheers, - Is there any viable solution through >> ANY << means?
- Well, kind of.
I am trying to work with Scott Mason to extend his 'WSDL Documentation' sample.
Cheers, I am able to document my Service using the code from the 'WSDL Documenation' sample but don't see a way of documenting the DataContract. Is this what you are working with Scott to provide?
Thanks,
Dave- Exactly.
- Do you have an idea when you will release a new sample with the annotation feature?
Thanks in advance Here is a post in which is explained a possible solution to make Xsd annotation with WCF
http://www.agilior.pt/blogs/bruno.camara/archive/2006/10/01/6.aspx
BFC


