本文整理汇总了C#中ODatabase.Clusters方法的典型用法代码示例。如果您正苦于以下问题:C# ODatabase.Clusters方法的具体用法?C# ODatabase.Clusters怎么用?C# ODatabase.Clusters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODatabase
的用法示例。
在下文中一共展示了ODatabase.Clusters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldRetrieveDataRangeForSingle
public void ShouldRetrieveDataRangeForSingle()
{
using (var context = new TestDatabaseContext())
using (var database = new ODatabase(TestConnection.GlobalTestDatabaseAlias))
{
var document = database.Clusters("OUser").Range();
Assert.IsNotNull(document);
Assert.AreEqual(1, document.Count);
Assert.IsTrue(document.ContainsKey("OUser"));
var document1 = database.Clusters(4).Range();
Assert.IsNotNull(document1);
Assert.AreEqual(1, document1.Count);
Assert.IsTrue(document1.ContainsKey("4"));
}
}
示例2: ShouldRetrieveDataRangeForMany
public void ShouldRetrieveDataRangeForMany()
{
using (var context = new TestDatabaseContext())
using (var database = new ODatabase(TestConnection.GlobalTestDatabaseAlias))
{
var document = database.Clusters("OUser","ORole","V").Range();
Assert.NotNull(document);
Assert.Equal(3, document.Count);
Assert.True(document.ContainsKey("OUser"));
Assert.True(document.ContainsKey("ORole"));
Assert.True(document.ContainsKey("V"));
var document1 = database.Clusters(4, 5, 9).Range();
Assert.NotNull(document1);
Assert.Equal(3, document1.Count);
Assert.True(document1.ContainsKey("4"));
Assert.True(document1.ContainsKey("5"));
Assert.True(document1.ContainsKey("9"));
}
}
示例3: ShouldRetrieveNumberRecordsInSingleCluster
public void ShouldRetrieveNumberRecordsInSingleCluster()
{
using (var context = new TestDatabaseContext())
using (var database = new ODatabase(TestConnection.GlobalTestDatabaseAlias))
{
database.Create.Class("TestDocumentClass").Run();
for (int i = 0; i < 100; i++)
{
database
.Create
.Document("TestDocumentClass")
.Set("bar", i)
.Run();
}
long recordsInCluster = database
.Clusters("TestDocumentClass")
.Count();
Assert.AreEqual(100, recordsInCluster);
}
}