コード例 #1
0
        public DB()
        {
            // This demo app opens/closes the database with each test.
            // That's not normally done: usually, the database is initialized only once when application is launched.
            // To optimize for such unusual use case, we're tuning a few advanced DB parameters here.
            EsentDatabase.Settings settings = new EsentDatabase.Settings();
            settings.advanced.EnableFileCache = true;               // Use Windows file cache
            settings.advanced.EnableViewCache = true;               // Read directly from the memory-mapped DB

            pool = EsentDatabase.open(settings, typeof(Record));

            // Precompile query to filter records by that random column.
            qBetween = pool.filter((Record r, int from, int to) => r.randomInt >= from && r.randomInt <= to);
        }