public static bool IsSensitive(string connectionString) { var csb = new DbConnectionStringBuilder(); csb.ConnectionString = connectionString; return(csb.ContainsAny("Password", "PWD")); }
private static DbConnectionStringBuilder GetBuilder(string serverNameOrConnectionString) { // Special handling of a connection string on the form: "powerbi://api.powerbi.com/v1.0/myorg/workspace;initial catalog=dbname" if (serverNameOrConnectionString.StartsWith("powerbi://", StringComparison.OrdinalIgnoreCase) && serverNameOrConnectionString.Contains(";")) { serverNameOrConnectionString = "Provider=MSOLAP;Data Source=" + serverNameOrConnectionString; } DbConnectionStringBuilder csb = new DbConnectionStringBuilder(); if (serverNameOrConnectionString.Contains("=")) { try { csb.ConnectionString = serverNameOrConnectionString; } catch (ArgumentException) { } } if (!csb.ContainsKey(ProviderKey)) { csb.Add(ProviderKey, "MSOLAP"); } if (!csb.ContainsAny(DataSourceKey, "DataSource")) { csb.Add(DataSourceKey, serverNameOrConnectionString); } return(csb); }
private static DbConnectionStringBuilder GetBuilder(string serverNameOrConnectionString) { DbConnectionStringBuilder csb = new DbConnectionStringBuilder(); try { csb.ConnectionString = serverNameOrConnectionString; } catch (ArgumentException ex) { } if (!csb.ContainsKey("Provider")) { csb.Add(ProviderKey, "MSOLAP"); } if (!csb.ContainsAny("Data Source", "DataSource")) { csb.Add(DataSourceKey, serverNameOrConnectionString); } return(csb); }