本文整理汇总了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;
}
}
示例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);
}
示例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);
}