本文整理汇总了C#中Storage.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Storage.SetProperty方法的具体用法?C# Storage.SetProperty怎么用?C# Storage.SetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage.SetProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssocDB
/// <summary>
/// AssocDB constructor. You should open and close storage yourself. You are free to set some storage properties,
/// storage listener and use some other storage administrative methods like backup.
/// But you should <b>not</b>: <ol>
/// <li>specify your own root object for the storage</li>
/// <li>use Storage commit or rollback methods directly</li>
/// <li>modify storage using Perst classes not belonging to this package</li>
/// </ol>
/// </summary>
/// <param name="storage">opened Perst storage</param>
public AssocDB(Storage storage)
{
this.storage = storage;
storage.SetProperty("perst.concurrent.iterator", true);
embeddedRelationThreshold = DEFAULT_EMBEDDED_RELATION_THRESHOLD;
language = DEFAULT_DOCUMENT_LANGUAGE;
root = (Root)storage.Root;
name2id = new Dictionary<string, int>();
id2name = new Dictionary<int, string>();
if (root == null)
{
root = CreateRoot();
storage.Root = root;
storage.Commit();
}
else
{
root.db = this;
IDictionaryEnumerator e = root.attributes.GetDictionaryEnumerator();
while (e.MoveNext())
{
int id = ((IPersistent)e.Value).Oid;
String name = (String)e.Key;
name2id[name] = id;
id2name[id] = name;
}
}
}
示例2: 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
}