本文整理汇总了C#中TableSchema.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TableSchema.ToString方法的具体用法?C# TableSchema.ToString怎么用?C# TableSchema.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableSchema
的用法示例。
在下文中一共展示了TableSchema.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render()
{
DropTables(this.regex);
Assert.IsFalse(Ns.TableExists("test-1"));
var schema = new TableSchema { AccessGroups = new List<AccessGroup>() };
var accessGroup = new AccessGroup { Name = "default", ColumnFamilies = new List<ColumnFamily>() };
accessGroup.ColumnFamilies.Add(new ColumnFamily { Name = "a" });
accessGroup.ColumnFamilies.Add(new ColumnFamily { Name = "b", Options = new ColumnFamilyOptions { MaxVersions = 5, MaxVersionsSpecified = true } });
schema.AccessGroups.Add(accessGroup);
accessGroup = new AccessGroup { Name = "other", ColumnFamilies = new List<ColumnFamily>() };
accessGroup.ColumnFamilies.Add(new ColumnFamily { Name = "c" });
schema.AccessGroups.Add(accessGroup);
var xml = schema.ToString();
schema = TableSchema.Parse(xml);
Assert.IsNotNull(schema);
Assert.IsFalse(schema.GenerationSpecified);
Assert.IsNotNull(schema.AccessGroups);
Assert.AreEqual(2, schema.AccessGroups.Count);
accessGroup = schema.AccessGroups[0];
Assert.AreEqual("default", accessGroup.Name);
Assert.IsNotNull(accessGroup.ColumnFamilies);
Assert.AreEqual(2, accessGroup.ColumnFamilies.Count);
var columnFamily = accessGroup.ColumnFamilies[0];
Assert.AreEqual("a", columnFamily.Name);
columnFamily = accessGroup.ColumnFamilies[1];
Assert.AreEqual("b", columnFamily.Name);
Assert.IsNotNull(columnFamily.Options);
Assert.IsTrue(columnFamily.Options.MaxVersionsSpecified);
Assert.AreEqual(5, columnFamily.Options.MaxVersions);
accessGroup = schema.AccessGroups[1];
Assert.AreEqual("other", accessGroup.Name);
Assert.IsNotNull(accessGroup.ColumnFamilies);
Assert.AreEqual(1, accessGroup.ColumnFamilies.Count);
columnFamily = accessGroup.ColumnFamilies[0];
Assert.AreEqual("c", columnFamily.Name);
Ns.CreateTable("test-1", xml);
Assert.IsTrue(Ns.TableExists("test-1"));
}