Ejemplo n.º 1
0
 private static long Time(IProcedure4 procedure4)
 {
     var storage = new PagingMemoryStorage();
     StoreItems(storage);
     StopWatch stopWatch = new AutoStopWatch();
     for (var i = 0; i < Iterations; ++i)
     {
         ApplyProcedure(storage, procedure4);
     }
     return stopWatch.Peek();
 }
Ejemplo n.º 2
0
        public static void UsingPagingMemoryStorage()
        {
            // #example: Using paging memory-storage
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
            PagingMemoryStorage memory = new PagingMemoryStorage();
            configuration.File.Storage = memory;
            IObjectContainer container = Db4oEmbedded.OpenFile(configuration, "database.db4o");
            // #end example
            container.Close();

        }
Ejemplo n.º 3
0
 private static void ApplyProcedure(PagingMemoryStorage storage, IProcedure4 procedure4
     )
 {
     var config = Db4oEmbedded.NewConfiguration();
     config.File.Storage = storage;
     var container = Db4oEmbedded.OpenFile(config, "benchmark.db4o"
         );
     try
     {
         procedure4.Apply(container);
     }
     finally
     {
         container.Close();
     }
 }
		private static void StoreItems(PagingMemoryStorage storage)
		{
			IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();
			config.File.Storage = storage;
			IEmbeddedObjectContainer container = Db4oEmbedded.OpenFile(config, "benchmark.db4o"
				);
			try
			{
				for (int i = 0; i < ObjectCount; ++i)
				{
					container.Store(new SodaQueryComparatorBenchmark.Item(i, "Item " + i, new SodaQueryComparatorBenchmark.ItemChild
						("Child " + i)));
				}
			}
			finally
			{
				container.Close();
			}
		}