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


C# TableContinuationToken.WriteXml方法代码示例

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


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

示例1: Serialize

 public string Serialize(TableContinuationToken continuationToken)
 {
     if (continuationToken == null) return null;
     StringBuilder sb = new StringBuilder();
     using (XmlWriter xmlWriter = XmlWriter.Create(new StringWriter(sb)))
     {
         continuationToken.WriteXml(xmlWriter);
     }
     return sb.ToString();
 }
开发者ID:JamesRandall,项目名称:AccidentalFish.ApplicationSupport,代码行数:10,代码来源:TableContinuationTokenSerializer.cs

示例2: Serialize

        public string Serialize(TableContinuationToken continuationToken)
        {
            if (continuationToken == null) return null;

            using (StringWriter stringWriter = new StringWriter())
            {
                using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter))
                {
                    continuationToken.WriteXml(xmlWriter);
                }
                return stringWriter.ToString();
            }
        }
开发者ID:vvmoppescapita,项目名称:AccidentalFish.ApplicationSupport,代码行数:13,代码来源:TableContinuationTokenSerializer.cs

示例3: SerializeToken

        public static string SerializeToken(TableContinuationToken token)
        {
            if (token == null)
            {
                return null;
            }

            using (var writer = new StringWriter(CultureInfo.InvariantCulture))
            {
                using (var xmlWriter = XmlWriter.Create(writer))
                {
                    token.WriteXml(xmlWriter);
                }
                string serialized = writer.ToString();
                var val = EncodeBase64(serialized);
                return val;
            }

           
        }
开发者ID:ConnorMcMahon,项目名称:azure-webjobs-sdk,代码行数:20,代码来源:Utility.cs

示例4: TableContinuationTokenVerifyEmptyTargetDeserializer

        public void TableContinuationTokenVerifyEmptyTargetDeserializer()
        {
            TableContinuationToken tableContinuationToken = new TableContinuationToken { NextTableName = "tableName", NextPartitionKey = "partitionKey", NextRowKey = "rowKey", TargetLocation = null };
            StringBuilder stringBuilder = new StringBuilder();
            using (XmlWriter writer = XmlWriter.Create(stringBuilder))
            {
                tableContinuationToken.WriteXml(writer);
            }

            string stringToken = stringBuilder.ToString();
            TableContinuationToken parsedToken = new TableContinuationToken();
            parsedToken.ReadXml(XmlReader.Create(new System.IO.StringReader(stringToken)));
            Assert.AreEqual(parsedToken.NextTableName, "tableName");
            Assert.AreEqual(parsedToken.NextPartitionKey, "partitionKey");
            Assert.AreEqual(parsedToken.NextRowKey, "rowKey");
            Assert.AreEqual(parsedToken.TargetLocation, null);
        }
开发者ID:mirobers,项目名称:azure-storage-net,代码行数:17,代码来源:CloudTableClientTests.cs

示例5: TableContinuationTokenVerifySerializer

        public void TableContinuationTokenVerifySerializer()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(TableContinuationToken));

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;

            StringReader reader;
            string tokenxml;

            TableContinuationToken writeToken = new TableContinuationToken
            {
                NextPartitionKey = Guid.NewGuid().ToString(),
                NextRowKey = Guid.NewGuid().ToString(),
                NextTableName = Guid.NewGuid().ToString(),
                TargetLocation = StorageLocation.Primary
            };

            TableContinuationToken readToken = null;

            // Write with XmlSerializer
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, writeToken);
                tokenxml = writer.ToString();
            }

            // Read with XmlSerializer
            reader = new StringReader(tokenxml);
            readToken = (TableContinuationToken)serializer.Deserialize(reader);
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);

            // Read with token.ReadXml()
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(tokenxml)))
            {
                readToken = new TableContinuationToken();
                readToken.ReadXml(xmlReader);
            }
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);

            // Read with token.ReadXml()
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(tokenxml)))
            {
                readToken = new TableContinuationToken();
                readToken.ReadXml(xmlReader);
            }

            // Write with token.WriteXml
            StringBuilder sb = new StringBuilder();
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
                writeToken.WriteXml(writer);
            }

            // Read with XmlSerializer
            reader = new StringReader(sb.ToString());
            readToken = (TableContinuationToken)serializer.Deserialize(reader);
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);

            // Read with token.ReadXml()
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(sb.ToString())))
            {
                readToken = new TableContinuationToken();
                readToken.ReadXml(xmlReader);
            }
            Assert.AreEqual(writeToken.NextTableName, readToken.NextTableName);
        }
开发者ID:mirobers,项目名称:azure-storage-net,代码行数:67,代码来源:CloudTableClientTests.cs


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