/// <summary> /// Create a connection using the configuration values. /// </summary> /// <param name="config"></param> /// <returns></returns> protected static SQLiteConnection CreateConnection(ConfigSqliteDatabase config) { // the connection string var connectionString = $"Data Source={config.Source};Version=3;Pooling=True;Max Pool Size=100;"; // the readonly. return(new SQLiteConnection(connectionString)); }
public SqliteReadWriteConnectionFactory(bool createTransaction, ConfigSqliteDatabase config) : base(CreateConnection(config)) { // save the config value if (null == config) { throw new ArgumentNullException(nameof(config)); } _cacheSize = config.CacheSize; _autoCheckpoint = config.AutoCheckpoint; _createTransaction = createTransaction; }
public SqlitePersister(IPerformance performance, IList <IFileParser> parsers, ILogger logger, ConfigSqliteDatabase config, int maxNumCharactersPerWords, int maxNumCharactersPerParts ) { // save the logger _logger = logger ?? throw new ArgumentNullException(nameof(logger)); // performance _performance = performance ?? throw new ArgumentNullException(nameof(performance)); // the configuration _config = config ?? throw new ArgumentNullException(nameof(config)); // create the configuration table. Config = new SqlitePersisterConfig(); // create the counters Counts = new SqlitePersisterCounts(logger); // word parts WordsParts = new SqlitePersisterWordsParts(logger); // create the words Words = new SqlitePersisterWords(performance, WordsParts, maxNumCharactersPerWords, logger); // file words. FilesWords = new SqlitePersisterFilesWords(Words, logger); // create the files / Folders. Folders = new SqlitePersisterFolders(Counts, parsers, logger); // the parts Parts = new SqlitePersisterParts(maxNumCharactersPerParts); // the query Query = new SqlitePersisterQuery(maxNumCharactersPerParts, logger); }