/// <summary> /// Returns a <see cref="ConnectionSettings"></see> for a given connection string. /// </summary> /// <param name="connectionString">The connection string to parse</param> /// <param name="builder">Pre-populated settings builder, optional. If not specified, a new builder will be created.</param> /// <returns>a <see cref="ConnectionSettings"/> from the connection string</returns> public static ConnectionSettings GetConnectionSettings(string connectionString, ConnectionSettingsBuilder builder = null) { var settings = (builder ?? ConnectionSettings.Create()).Build(); var items = GetConnectionStringInfo(connectionString).ToArray(); return(Apply(items, settings)); }
/// <summary> /// Creates a new <see cref="IEventStoreConnection"/> to single node using default <see cref="ConnectionSettings"/> provided via a connectionstring /// </summary> /// <param name="connectionName">Optional name of connection (will be generated automatically, if not provided)</param> /// <param name="builder">Pre-populated settings builder, optional. If not specified, a new builder will be created.</param> /// <param name="connectionString">The connection string to for this connection.</param> /// <returns>a new <see cref="IEventStoreConnection"/></returns> public static IEventStoreConnection Create(string connectionString, ConnectionSettingsBuilder builder, string connectionName = null) { var settings = ConnectionString.GetConnectionSettings(connectionString, builder); var uri = GetUriFromConnectionString(connectionString); if (uri == null && (settings.GossipSeeds == null || settings.GossipSeeds.Length == 0)) { throw new Exception(string.Format("Did not find ConnectTo or GossipSeeds in the connection string.\n'{0}'", connectionString)); } if (uri != null && settings.GossipSeeds != null && settings.GossipSeeds.Length > 0) { throw new NotSupportedException(string.Format("Setting ConnectTo as well as GossipSeeds on the connection string is currently not supported.\n{0}", connectionString)); } return(Create(settings, uri, connectionName)); }
private static ConnectionSettingsBuilder DefaultConfigureSettings( ConnectionSettingsBuilder builder) => builder;
public static ConnectionSettingsBuilder UseSsl(this ConnectionSettingsBuilder builder, bool useSsl) => useSsl?builder.DisableServerCertificateValidation() : builder.DisableTls();
public static ConnectionSettingsBuilder UseSsl(this ConnectionSettingsBuilder builder, bool useSsl) => useSsl?builder.UseSslConnection(Guid.NewGuid().ToString("n"), false) : builder;