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


C# TableContinuationToken.ReadXml方法代码示例

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


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

示例1: DeserializeToken

        public static TableContinuationToken DeserializeToken(string token)
        {
            if (!string.IsNullOrWhiteSpace(token))
            {
                var raw = DecodeBase64(token);
                TableContinuationToken contToken = null;

                using (var stringReader = new StringReader(raw))
                {
                    contToken = new TableContinuationToken();
                    using (var xmlReader = XmlReader.Create(stringReader))
                    {
                        contToken.ReadXml(xmlReader);
                    }
                }
                return contToken;
            }
            return null;            
        }
开发者ID:ConnorMcMahon,项目名称:azure-webjobs-sdk,代码行数:19,代码来源:Utility.cs

示例2: TableContinuationTokenVerifyXmlWithinXml

        public void TableContinuationTokenVerifyXmlWithinXml()
        {
            CloudTableClient tableClient = GenerateCloudTableClient();

            TableResultSegment segment = null;
            List<CloudTable> totalResults = new List<CloudTable>();
            TableContinuationToken token = null;
            do
            {
                segment = tableClient.ListTablesSegmented("prefixtable", 5, segment != null ? segment.ContinuationToken : null);
                totalResults.AddRange(segment);
                token = segment.ContinuationToken;
                if (token != null)
                {
                    Assert.AreEqual(null, token.GetSchema());

                    XmlWriterSettings settings = new XmlWriterSettings();
                    settings.Indent = true;
                    StringBuilder sb = new StringBuilder();
                    using (XmlWriter writer = XmlWriter.Create(sb, settings))
                    {
                        writer.WriteStartElement("test1");
                        writer.WriteStartElement("test2");
                        token.WriteXml(writer);
                        writer.WriteEndElement();
                        writer.WriteEndElement();
                    }

                    using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString())))
                    {
                        token = new TableContinuationToken();
                        reader.ReadStartElement();
                        reader.ReadStartElement();
                        token.ReadXml(reader);
                        reader.ReadEndElement();
                        reader.ReadEndElement();
                    }
                }
            }
            while (token != null);

            Assert.AreEqual(totalResults.Count, tableClient.ListTables("prefixtable").Count());
        }
开发者ID:mirobers,项目名称:azure-storage-net,代码行数:43,代码来源:CloudTableClientTests.cs

示例3: 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

示例4: 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

示例5: Deserialize

        public TableContinuationToken Deserialize(string serializedContinuationToken)
        {
            if (serializedContinuationToken == null) return null;

            TableContinuationToken continuationToken = new TableContinuationToken();
            using (XmlReader xmlReader = XmlReader.Create(new StringReader(serializedContinuationToken)))
            {
                continuationToken.ReadXml(xmlReader);
            }
            return continuationToken;
        }
开发者ID:JamesRandall,项目名称:AccidentalFish.ApplicationSupport,代码行数:11,代码来源:TableContinuationTokenSerializer.cs


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