示例#1
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");
 }
示例#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");
        }