public DatabaseConnectionProtocolConfiguration <TDataType> Connect(IDatabaseConnectionProtocol <TDataType> protocol) { if (protocol == null) { throw new ArgumentNullException($"{nameof(protocol)} cannot be null."); } _configAction(protocol); return(new DatabaseConnectionProtocolConfiguration <TDataType>(_configuration, _parser, _configAction)); }
internal ArangoDBConnection(IDatabaseRecordParser <TDataType> parser, IDatabaseConnectionProtocol <TDataType> protocol, ILogger logger, string database) { if (parser == null) { throw new ArgumentNullException($"{nameof(parser)}"); } if (protocol == null) { throw new ArgumentNullException($"{nameof(protocol)}"); } if (string.IsNullOrWhiteSpace(database)) { throw new ArgumentException($"{nameof(database)}"); } _logger = logger ?? throw new ArgumentNullException($"{nameof(logger)}"); _serverConnection = protocol.CreateServerConnection(parser, logger); _databaseConnection = _serverConnection.Connect(database); }
internal DatabaseConnectionFactory(IDatabaseConnectionProtocol <TDataType> protocol, IDatabaseRecordParser <TDataType> parser, ILogger logger) { _connectionProtocol = protocol ?? throw new ArgumentNullException($"{nameof(protocol)} cannot be null."); _parser = parser ?? throw new ArgumentNullException($"{nameof(parser)} cannot be null"); _logger = logger ?? throw new ArgumentNullException($"{nameof(logger)} cannot be null"); }