本文整理汇总了C#中SessionBase.DeleteDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# SessionBase.DeleteDatabase方法的具体用法?C# SessionBase.DeleteDatabase怎么用?C# SessionBase.DeleteDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionBase
的用法示例。
在下文中一共展示了SessionBase.DeleteDatabase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Recover1
public void Recover1(SessionBase session)
{
Database db = null;
session.BeginUpdate();
db = session.OpenDatabase(88, true, false);
if (db != null)
session.DeleteDatabase(db);
db = session.OpenDatabase(89, true, false);
if (db != null)
session.DeleteDatabase(db);
session.Commit();
session.BeginUpdate();
db = session.NewDatabase(88);
session.FlushUpdates();
session.Abort();
session.BeginUpdate();
db = session.NewDatabase(88);
SortedSetAny<float> floatSet;
Oid floatSetOid;
string dbPath = System.IO.Path.Combine(systemDir, "89.odb");
Placement place = new Placement(88);
for (int i = 0; i < 10; i++)
{
floatSet = new SortedSetAny<float>();
floatSet.Persist(place, session);
floatSetOid = floatSet.Oid;
}
db = session.NewDatabase(89);
session.Commit();
File.Delete(dbPath);
session.BeginUpdate();
db = session.NewDatabase(89);
session.Commit();
FileInfo info = new FileInfo(dbPath);
info.CopyTo(dbPath + "X");
session.BeginUpdate();
SortedSetAny<int> intSet;
place = new Placement(89);
for (int i = 0; i < 10; i++)
{
intSet = new SortedSetAny<int>();
intSet.Persist(place, session);
}
db = session.OpenDatabase(88);
var list = db.AllObjects<SortedSetAny<float>>();
foreach (SortedSetAny<float> set in list)
set.Unpersist(session);
db = session.OpenDatabase(89);
session.Commit();
intSet = null;
db = null; // release refs so that cached data isn't stale
File.Delete(dbPath);
info = new FileInfo(dbPath + "X");
info.MoveTo(dbPath);
session.BeginUpdate();
intSet = (SortedSetAny<int>)session.Open(89, 1, 1, false);
Debug.Assert(intSet == null);
object o = session.Open(88, 1, 1, false);
floatSet = (SortedSetAny<float>)o;
Debug.Assert(floatSet != null);
session.Commit();
session.BeginUpdate();
db = session.OpenDatabase(88);
session.DeleteDatabase(db);
db = session.OpenDatabase(89);
session.DeleteDatabase(db);
session.Commit();
}