/// <summary> /// Set the connection string. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="connectionString">Connection string that will be used to connect to the cassandra cluster.</param> /// <returns></returns> public static T SetConnectionString <T>(this T self, string connectionString) where T : ICassandraEventStoreSettings { var builder = new DataStaxCassandra.CassandraConnectionStringBuilder(connectionString); if (string.IsNullOrWhiteSpace(builder.DefaultKeyspace) == false) { self.ConnectionString = connectionString.Replace(builder.DefaultKeyspace, ""); self.SetKeyspace(builder.DefaultKeyspace); } else { self.ConnectionString = connectionString; } return(self); }
/// <summary> /// Configure the cluster by applying settings from ConnectionString. /// </summary> /// <param name="connectionString"> the ConnectionString to use </param> /// /// <returns>this Builder</returns> public Builder WithConnectionString(string connectionString) { var cnb = new CassandraConnectionStringBuilder(connectionString); return(cnb.ApplyToBuilder(this)); }