public VendorRepository(ILoggerFactory loggerService) { var databaseName = "vendor"; path = Environment.GetEnvironmentVariable("DATA_DIR"); logger = loggerService.CreateLogger(databaseName); var cfg = new BTreeDatabaseConfig { Creation = CreatePolicy.IF_NEEDED, CacheSize = new CacheInfo(1, 0, 1), ErrorFeedback = (prefix, message) => { var fg = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{prefix}: {message}"); Console.ForegroundColor = fg; }, ErrorPrefix = databaseName, //Duplicates = DuplicatesPolicy.SORTED, //TableSize = tableSize }; // we have 50k vendors, so we're going to split into two equal partitions of 25k cfg.SetPartitionByKeys(new[] { new DatabaseEntry(BitConverter.GetBytes(25000)) }); cfg.SetPartitionByCallback(3, key => { return(0); }); db = BTreeDatabase.Open(Path.Combine(path, databaseName + ".db"), cfg); BTreeDatabase.Verify("", cfg, Database.VerifyOperation.DEFAULT); }