本文整理汇总了C#中ODatabase.Close方法的典型用法代码示例。如果您正苦于以下问题:C# ODatabase.Close方法的具体用法?C# ODatabase.Close怎么用?C# ODatabase.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODatabase
的用法示例。
在下文中一共展示了ODatabase.Close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldReturnDatabaseToPoolAfterCloseAndDisposeCall
public void ShouldReturnDatabaseToPoolAfterCloseAndDisposeCall()
{
using (TestDatabaseContext testContext = new TestDatabaseContext())
{
Assert.AreEqual(
TestConnection.GlobalTestDatabasePoolSize,
OClient.DatabasePoolCurrentSize(TestConnection.GlobalTestDatabaseAlias)
);
ODatabase database = new ODatabase(TestConnection.GlobalTestDatabaseAlias);
Assert.AreEqual(
TestConnection.GlobalTestDatabasePoolSize - 1,
OClient.DatabasePoolCurrentSize(TestConnection.GlobalTestDatabaseAlias)
);
database.Close();
Assert.AreEqual(
TestConnection.GlobalTestDatabasePoolSize,
OClient.DatabasePoolCurrentSize(TestConnection.GlobalTestDatabaseAlias)
);
database.Dispose();
Assert.AreEqual(
TestConnection.GlobalTestDatabasePoolSize,
OClient.DatabasePoolCurrentSize(TestConnection.GlobalTestDatabaseAlias)
);
}
}
示例2: TestDatabaseCloseConnection
public void TestDatabaseCloseConnection()
{
using (ODatabase database = new ODatabase(_hostname, _port, _databaseName, ODatabaseType.Document, _username, _password))
{
database.Close();
Assert.IsTrue(database.SessionID == -1);
}
}
示例3: TestGetDatabase
public void TestGetDatabase()
{
using (ODatabase database = new ODatabase(_poolAlias))
{
Assert.IsTrue(database.SessionID > 0);
DatabasePool pool = EasternClient.GetDatabasePool(_poolAlias);
Assert.IsTrue(pool.CurrentPoolSize == (pool.PoolSize - 1));
Assert.IsFalse(pool.ContainsDatabaseSession(database.SessionID));
database.Close();
Assert.IsTrue(pool.CurrentPoolSize == pool.PoolSize);
Assert.IsTrue(pool.ContainsDatabaseSession(database.SessionID));
}
}
示例4: Do
static long Do()
{
DateTime start = DateTime.Now;
bool running = true;
long tps = 0;
do
{
ODatabase database = new ODatabase(_alias);
//List<ORecord> result = database.Query("select name from OGraphVertex where in[0].label = 'followed_by' and in[0].out.name = 'JAM'");
//List<ORecord> result = database.Query("select from OGraphVertex limit 20");
List<ORecord> result = database.Query("select from OGraphEdge limit 20");
database.Close();
tps++;
TimeSpan dif = DateTime.Now - start;
if (dif.TotalMilliseconds > 1000)
{
running = false;
}
}
while (running);
return tps;
}