本文整理汇总了C#中SessionNoServer.Compact方法的典型用法代码示例。如果您正苦于以下问题:C# SessionNoServer.Compact方法的具体用法?C# SessionNoServer.Compact怎么用?C# SessionNoServer.Compact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionNoServer
的用法示例。
在下文中一共展示了SessionNoServer.Compact方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: hashCodeComparerStringTest
public void hashCodeComparerStringTest()
{
Oid id;
using (SessionNoServer session = new SessionNoServer(systemDir))
{
Placement place = new Placement(223, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
session.Compact();
session.BeginUpdate();
HashCodeComparer<string> hashCodeComparer = new HashCodeComparer<string>();
BTreeSet<string> bTree = new BTreeSet<string>(hashCodeComparer, session);
bTree.Persist(place, session);
id = bTree.Oid;
for (int i = 0; i < 100000; i++)
{
bTree.Add(i.ToString());
}
session.Commit();
}
using (SessionNoServer session = new SessionNoServer(systemDir))
{
session.BeginRead();
BTreeSet<string> bTree= (BTreeSet<string>)session.Open(id);
int count = 0;
foreach (string str in bTree)
{
count++;
}
Assert.True(100000 == count);
session.Commit();
}
}
示例2: CsvExport
public void CsvExport()
{
using (SessionNoServer session = new SessionNoServer(systemDir))
{
session.Compact();
session.BeginRead();
session.ExportToCSV(csvExportDir);
session.Commit();
}
}
示例3: aCreateDefaultCompareIntKeyIntValue
public void aCreateDefaultCompareIntKeyIntValue(int number)
{
Oid id;
using (SessionNoServer session = new SessionNoServer(systemDir))
{
Placement place = new Placement((UInt32)number, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
session.Compact();
session.BeginUpdate();
BTreeMap<int, int> bTree = new BTreeMap<int, int>(null, session);
bTree.Persist(place, session);
id = bTree.Oid;
for (int i = 0; i < number; i++)
{
bTree.Add(i, i + 1);
}
bTree.Clear();
for (int i = 0; i < number; i++)
{
bTree.Add(i, i + 1);
}
session.Commit();
}
using (SessionNoServer session = new SessionNoServer(systemDir))
{
session.BeginRead();
BTreeMap<int, int> bTree = (BTreeMap<int, int>)session.Open(id);
int count = 0;
int prior = 0;
foreach (KeyValuePair<int, int> pair in bTree)
{
count++;
Assert.True(pair.Key == prior++);
Assert.True(pair.Key == pair.Value - 1);
}
Assert.True(number == count);
session.Commit();
}
}