本文整理汇总了C#中Storage.Open方法的典型用法代码示例。如果您正苦于以下问题:C# Storage.Open方法的具体用法?C# Storage.Open怎么用?C# Storage.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage.Open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(String[] args) {
db = StorageFactory.Instance.CreateStorage();
if (args.Length > 0)
{
db.SetProperty("perst.object.cache.kind", args[0]);
}
db.Open("testconcur.dbs");
L2List list = (L2List)db.Root;
if (list == null) {
list = new L2List();
list.head = new L2Elem();
list.head.next = list.head.prev = list.head;
db.Root = list;
for (int i = 1; i < nElements; i++) {
L2Elem elem = new L2Elem();
elem.count = i;
elem.linkAfter(list.head);
}
}
Thread[] threads = new Thread[nThreads];
for (int i = 0; i < nThreads; i++) {
threads[i] = new Thread(new ThreadStart(run));
threads[i].Start();
}
#if !COMPACT_NET_FRAMEWORK
for (int i = 0; i < nThreads; i++)
{
threads[i].Join();
}
db.Close();
#endif
}
示例2: PerstDB
const int PagePoolSize = 32 * 1024 * 1024; // database cache size
#endregion Fields
#region Constructors
public PerstDB()
{
db = StorageFactory.Instance.CreateStorage();
db.Open("perst.dbs", PagePoolSize);
root = (Root)db.Root; // get storage root
if (root == null)
{
root = new Root(db); // create root object
db.Root = root; // register root object
}
}
示例3: Open
/// <summary>Open database</summary>
/// <param name="filePath">path to the database file</param>
public void Open(string filePath)
{
db = StorageFactory.Instance.CreateStorage();
db.Open(filePath);
root = (DatabaseRoot)db.Root;
if (root == null)
{
root = new DatabaseRoot();
root.prefixUriIndex = db.CreateIndex(typeof(string), true);
root.suffixUriIndex = db.CreateIndex(typeof(string), true);
root.strPropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(string)}, false);
root.numPropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(double)}, false);
root.refPropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(VersionHistory)}, false);
root.timePropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(DateTime)}, false);
root.propDefIndex = db.CreateFieldIndex(typeof(PropDef), "name", true);
root.timeIndex = db.CreateFieldIndex(typeof(Thing), "timestamp", false);
root.inverseIndex = db.CreateIndex(typeof(string), false);
root.spatialIndex = db.CreateSpatialIndexR2();
root.latest = db.CreateSet();
CreateMetaType();
db.Root = root;
}
}