当前位置: 首页>>代码示例>>C#>>正文


C# Schema.GetVersion方法代码示例

本文整理汇总了C#中Schema.GetVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.GetVersion方法的具体用法?C# Schema.GetVersion怎么用?C# Schema.GetVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schema的用法示例。


在下文中一共展示了Schema.GetVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteVersion

 /// <summary>
 /// This method is used to write the version attribute. A version is
 /// written only if it is not the initial version or if it required.
 /// The version is used to determine how to deserialize the XML. If
 /// the version is different from the expected version then it allows
 /// the object to be deserialized in a manner that does not require
 /// any attributes or elements, and unmatched nodes are ignored.
 /// </summary>
 /// <param name="node">
 /// this is the node to read the version attribute from
 /// </param>
 /// <param name="source">
 /// this is the source object that is to be written
 /// </param>
 /// <param name="schema">
 /// this is the schema that contains the version
 /// </param>
 public void WriteVersion(OutputNode node, Object source, Schema schema) {
    Version version = schema.getRevision();
    Label label = schema.GetVersion();
    if(version != null) {
       Double start = revision.Default;
       Double value = version.revision();
       if(revision.Compare(value, start)) {
          if(label.isRequired()) {
             WriteAttribute(node, value, label);
          }
       } else {
          WriteAttribute(node, value, label);
       }
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:32,代码来源:Composite.cs

示例2: ReadVersion

 /// <summary>
 /// This method is used to read the version from the provided input
 /// node. Once the version has been read it is used to determine how
 /// to deserialize the object. If the version is not the initial
 /// version then it is read in a manner that ignores excessive XML
 /// elements and attributes. Also none of the annotated fields or
 /// methods are required if the version is not the initial version.
 /// </summary>
 /// <param name="node">
 /// the XML element contact values are deserialized from
 /// </param>
 /// <param name="source">
 /// this object whose contacts are to be deserialized
 /// </param>
 /// <param name="schema">
 /// this object visits the objects contacts
 /// </param>
 public void ReadVersion(InputNode node, Object source, Schema schema) {
    Label label = schema.GetVersion();
    Class expect = type.Type;
    if(label != null) {
       String name = label.GetName();
       NodeMap<InputNode> map = node.getAttributes();
       InputNode value = map.Remove(name);
       if(value != null) {
          ReadVersion(value, source, label);
       } else {
          Version version = context.GetVersion(expect);
          Double start = revision.Default;
          Double expected = version.revision();
          criteria.Set(label, start);
          revision.Compare(expected, start);
       }
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:35,代码来源:Composite.cs


注:本文中的Schema.GetVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。