using FruityFoundation.DataAccess.Abstractions; namespace FruityFoundation.DataAccess.Sqlite; public class DbConnectionFactory : IDbConnectionFactory { private readonly string _readWriteConnectionString; private readonly string _readOnlyConnectionString; public DbConnectionFactory(string readWriteConnectionString, string readOnlyConnectionString) { _readWriteConnectionString = readWriteConnectionString; _readOnlyConnectionString = readOnlyConnectionString; } public INonTransactionalDbConnection CreateConnection() { if (string.IsNullOrWhiteSpace(_readWriteConnectionString)) throw new ApplicationException("ReadWrite connection string cannot be null or empty."); var connection = new NonTransactionalDbConnection(_readWriteConnectionString); return connection; } public INonTransactionalDbConnection CreateReadOnlyConnection() { if (string.IsNullOrWhiteSpace(_readOnlyConnectionString)) throw new ApplicationException("ReadOnly connection string cannot be null or empty."); var connection = new NonTransactionalDbConnection(_readOnlyConnectionString); return connection; } }