Esempio n. 1
0
        public static void CachingStorage()
        {
            // #example: Using a caching storage
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
            IStorage fileStorage = new FileStorage();
            IStorage cachingStorage = new CachingStorage(fileStorage, 128, 1024);
            configuration.File.Storage = cachingStorage;
            IObjectContainer container = Db4oEmbedded.OpenFile(configuration, "database.db4o");
            // #end example

        }
Esempio n. 2
0
 public static void StorageStack()
 {
     IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();
     // #example: You stack up different storage-decorator to add functionality
     // the basic file storage
     IStorage fileStorage = new FileStorage();
     // add your own decorator
     IStorage myStorageDecorator = new MyStorageDecorator(fileStorage);
     // add caching to the storage
     IStorage storageWithCaching = new CachingStorage(myStorageDecorator);
     // finally configure db4o with our storage-stack
     configuration.File.Storage = storageWithCaching;
     // #end example
     IObjectContainer container = Db4oEmbedded.OpenFile(configuration, "database.db4o");
 }