Beispiel #1
0
		public void SetUp()
		{
			_filePath = Path.GetTempFileName();
			//Db4objects.Db4o.Config.IConfiguration db4oConfiguration = Db4oFactory.Configure();
			//Db4objects.Db4o.Config.IObjectClass objectClass = db4oConfiguration.ObjectClass(typeof(LanguageForm));
			// objectClass.ObjectField("_writingSystemId").Indexed(true);
			// objectClass.ObjectField("_form").Indexed(true);

			_db = Db4oFactory.OpenFile(_filePath);
			((YapStream) _db).GetNativeQueryHandler().QueryOptimizationFailure +=
					OnQueryOptimizationFailure;

			for (int i = 0;i < 10000;i++)
			{
				Entry e = new Entry();
				e.name = new MultiText();
				e.name._forms[0] = new LanguageForm("en", "en-" + i);
				//e.name._forms[1] = new LanguageForm("fr", "fr-"+i);
				e.name._singleForm = new LanguageForm("en", i.ToString());
				_db.Set(e);
			}

			_db.Commit();
			_db.Dispose();
			_db = Db4oFactory.OpenFile(_filePath);
		}
Beispiel #2
0
 public Object OnStore(IObjectContainer objectContainer, object obj){
     IDictionary dict = (IDictionary)obj;
     Entry[] entries = new Entry[dict.Count];
     IDictionaryEnumerator e = dict.GetEnumerator();
     e.Reset();
     for(int i = 0; i < dict.Count; i++){
         e.MoveNext();
         entries[i] = new Entry();
         entries[i].key = e.Key;
         entries[i].value = e.Value;
     }
     return entries;
 }