public UserRepository(string clusterName, string dbName, string tableName) { if (!string.IsNullOrEmpty(clusterName) && !string.IsNullOrEmpty(dbName) && !string.IsNullOrEmpty(tableName)) { _connectionFactory = ConfigurationAssembler.CreateConnectionFactory(clusterName); _db = Query.Db(dbName); _table = _db.Table<User>(tableName); } }
/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="connectionFactory">The connection factory for connecting to RethinkDB.</param> /// <param name="batchSizeLimit">The maximum number of events to post in a single batch.</param> /// <param name="period">The time to wait between checking for event batches.</param> /// <param name="databaseName">Name of the RethinkDB database to use for the log.</param> /// <param name="tableName">Name of the RethinkDB collection to use for the log. Default is "log".</param> public RethinkDBSink(IConnectionFactory connectionFactory, string databaseName, string tableName, int batchSizeLimit, TimeSpan period) : base(batchSizeLimit, period) { if (connectionFactory == null) { throw new ArgumentNullException("connectionFactory"); } _connectionFactory = connectionFactory; _db = Query.Db(databaseName); _table = _db.Table <RethinkDBLogEvent>(tableName); EnsureDbCreated(databaseName, tableName); }