最近的工作是围绕接口进行第三方开发,其中一个是第三方给出接口,在系统中进行接入。主要的困难时接口说明不详细,需要 很多次的尝试。在这里学习到如何去写接口说明
xml作为Webservice的一种返回信息的常见格式,经常可以在接口开发中遇到。
xml生成xsd架构xsd d:\TDDOWNLOAD\atom-author-link.xml /c /language:C# /outputdir:d:\
xml架构生成对应的类xsd d:\TDDOWNLOAD\atom-author-link.xsd /c /language:C# /outputdir:d:\
使用该模式进行数据库映射的时候,如果出现命名空间不一样,类名一样的情况会报错,需改更改类名,此外可以使用DataAnnonation进行xmlfan反序列化的映射,如下面的LicensesJDS对应xml文档中Licenses节点名
/// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false, ElementName = "Licenses")] public partial class LicensesJDS { [Key] public int ID { get; set; } private List<LicensesLicenseJDS> licenseField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("license")] public List<LicensesLicenseJDS> license { get { return this.licenseField; } set { this.licenseField = value; } } }