Here are the examples of the csharp api class System.Data.Common.DbConnectionStringBuilder.ContainsKey(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
26 Examples
0
1. Example
View licenseprivate T DefaultIfNotExists<T>(string name, T def) { if (!base.ContainsKey(name)) return def; return (T) Convert.ChangeType(base[name], typeof (T)); }
0
2. Example
View licenseprivate T ThrowIfNotExists<T>(string name) { if (!base.ContainsKey(name)) throw new FormatException(name + " value are missing in connection string"); return (T) Convert.ChangeType(base[name], typeof (T)); }
0
3. Example
View licenseprivate string GetValueOrDefault(string key, string defaultValue = "") { key = key.ToLower(); if (ContainsKey(key)) { return (string) this[key]; } return defaultValue; }
0
4. Example
View licensepublic static string GetConnectionStringWithoutProvider(string connStr) { var builder = new DbConnectionStringBuilder(); builder.ConnectionString = connStr; if (builder.ContainsKey("provider")) builder.Remove("provider"); return builder.ConnectionString; }
0
5. Example
View licenseprivate string GetDatabaseName(string constr) { var builder = new DbConnectionStringBuilder { ConnectionString = constr }; if (builder.ContainsKey("Initial Catalog")) { return (string)builder["Initial Catalog"]; } if (builder.ContainsKey("Database")) { return (string)builder["Database"]; } if (builder.ContainsKey("AttachDBFileName")) { return (string)builder["AttachDBFileName"]; } if (builder.ContainsKey("Data Source") && ((string)builder["Data Source"]).EndsWith(".sdf", StringComparison.OrdinalIgnoreCase)) { return (string)builder["Data Source"]; } return this.services.Model.DatabaseName; }
0
6. Example
View licenseprivate string GetDatabaseName(string constr) { DbConnectionStringBuilder builder = new DbConnectionStringBuilder(); builder.ConnectionString = constr; if (builder.ContainsKey("Initial Catalog")) { return (string)builder["Initial Catalog"]; } if (builder.ContainsKey("Database")) { return (string)builder["Database"]; } if (builder.ContainsKey("AttachDBFileName")) { return (string)builder["AttachDBFileName"]; } if (builder.ContainsKey("Data Source") && ((string)builder["Data Source"]).EndsWith(".sdf", StringComparison.OrdinalIgnoreCase)) { return (string)builder["Data Source"]; } return services.Model.DatabaseName; }
0
7. Example
View licensebool System.Collections.IDictionary.Contains(object keyword) { return ContainsKey(ObjectToString(keyword)); }
0
8. Example
View licensepublic bool ContainsKey(Keywords keyword) { return base.ContainsKey(GetKeyName(keyword)); }
0
9. Example
View licenseprivate static string GetDataSourceFilePath(DbConnectionStringBuilder builder, string connectionString) { builder.ConnectionString = connectionString; if (!builder.ContainsKey("Data Source")) throw new ArgumentException("A 'Data Source' parameter was expected in the supplied connection string, but it was not found."); string dataSource = builder["Data Source"].ToString(); return ResolveDataSourceFilePath(dataSource); }
0
10. Example
View licensestatic string GetDataSourceFilePath(DbConnectionStringBuilder builder, string connectionString) { builder.ConnectionString = connectionString; if (!builder.ContainsKey("Data Source")) throw new ArgumentException("A 'Data Source' parameter was expected in the supplied connection string, but it was not found."); var dataSource = builder["Data Source"].ToString(); return ResolveDataSourceFilePath(dataSource); }
0
11. Example
View licenseprivate static string GetProvider(DbConnectionStringBuilder csb) { const string key = "provider"; string provider = "System.Data.SqlClient"; // default factory provider if (csb.ContainsKey(key)) { provider = csb[key].ToString(); csb.Remove(key); } return provider; }
0
12. Example
View licensepublic override bool ContainsKey(string keyword) { keyword = keyword.ToUpper().Trim(); if(_keywords.ContainsKey(keyword)) return base.ContainsKey(_keywords[keyword]); return false; }
0
13. Example
View licenseprivate static int? GetCommandTimeout(DbConnectionStringBuilder csb) { const string key = "CommandTimeout"; int? value = null; if (csb.ContainsKey(key)) { int iValue; if (Int32.TryParse(csb[key].ToString(), out iValue)) { // ignore negative values if (iValue >= 0) { value = iValue; } } csb.Remove(key); } return value; }
0
14. Example
View license[MethodImpl(MethodImplOptions.Synchronized)] public void Open() { if (!p/n ..... /n //View Source file for more details /n }
0
15. Example
View licensepublic void Initialize(string connectionString) { var parser = new DbConnectionStringBuilder {ConnectionString = connectionString}; if (parser.ContainsKey("Data Source")) _skipFilePath = parser["Data Source"].ToString(); else { var mediaStorageLocation = PlayOnSettings.GetMediaStorageLocation(); if (mediaStorageLocation == "") throw new Exception("Unable to find PlayLater's Media Storage Location"); _skipFilePath = mediaStorageLocation; } if (!Directory.Exists(_skipFilePath)) throw new Exception(String.Format("Queue List data path does not exists: {0}", _skipFilePath)); }
0
16. Example
View licensepublic void Initialize(string connectionString) { var parser = new DbConnectionStringBuilder {ConnectionString = connectionString}; var fileName = parser.ContainsKey("Filename") ? parser["Filename"].ToString() : Path.Combine(Directory.GetCurrentDirectory(), "PlayPass.log"); var appendMode = !parser.ContainsKey("Append") || (parser["Append"].ToString() == "1"); _file = new StreamWriter(fileName, appendMode) {AutoFlush = true}; }
0
17. Example
View licenseinternal void Normalize() { // Ensure instance id for transient connection if (this.IsTransient && string.IsNullOrEmpty(this.InstanceId)) { this.InstanceId = Guid.NewGuid().ToString(); } // Remove the transient information if (this.ContainsKey(IsTransientKey)) { this.Remove(IsTransientKey); } }
0
18. Example
View licenseprivate static void SetDataHelperNamesLegacyConnectionString(DbConnectionStringBuilder connectionStringBuilder) { // get the data layer type and parse it var datalayerType = String.Empty; if (connectionStringBuilder.ContainsKey(ConnectionStringDataLayerIdentifier)) { datalayerType = connectionStringBuilder[ConnectionStringDataLayerIdentifier].ToString(); connectionStringBuilder.Remove(ConnectionStringDataLayerIdentifier); } _connectionString = connectionStringBuilder.ConnectionString; var datalayerTypeParts = datalayerType.Split(",".ToCharArray()); _dataHelperTypeName = datalayerTypeParts[0].Trim(); _dataHelperAssemblyName = datalayerTypeParts.Length < 2 ? string.Empty : datalayerTypeParts[1].Trim(); if (datalayerTypeParts.Length > 2 || (_dataHelperTypeName.Length == 0 && _dataHelperAssemblyName.Length > 0)) throw new ArgumentException("Illegal format of data layer property. Should be 'DataLayer = Full_Type_Name [, Assembly_Name]'.", "connectionString"); }
0
19. Example
View licensepublic static ILogger GetLogger(string connectionString, bool debugMode, bool verboseMode) { var parser = new DbConnectionStringBuilder {ConnectionString = connectionString}; if (!parser.ContainsKey("Provider")) throw new Exception("Logger Provider Type is not specified"); var providerType = parser["Provider"].ToString().ToUpper(); if (!Classes.ContainsKey(providerType)) throw new Exception(String.Format("Unregistered Logger Provider Type: {0}", providerType)); var type = Classes[providerType]; var instance = (ILogger) Activator.CreateInstance(type); instance.DebugMode = debugMode; instance.VerboseMode = verboseMode; instance.Initialize(connectionString); return instance; }
0
20. Example
View licensepublic static IQueueList GetQueueList(string connectionString) { var parser = new DbConnectionStringBuilder {ConnectionString = connectionString}; if (!parser.ContainsKey("Provider")) throw new Exception("Queue List Provider Type is not specified"); var providerType = parser["Provider"].ToString().ToUpper(); if (!Classes.ContainsKey(providerType)) throw new Exception(String.Format("Unregistered Queue List Provider Type: {0}", providerType)); var type = Classes[providerType]; var instance = (IQueueList) Activator.CreateInstance(type); instance.Initialize(connectionString); return instance; }
0
21. Example
View licensepublic void CleanCache() { using (var conn = new AdomdConnection(command.Connection.ConnectionString)) { string xmla = string.Empty; using (var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("NBi.Core.Query.CleanCache.xmla")) using (var reader = new StreamReader(stream)) xmla = reader.ReadToEnd(); var csb = new DbConnectionStringBuilder(); csb.ConnectionString = conn.ConnectionString; if (!csb.ContainsKey("Initial Catalog")) throw new ArgumentException("The token 'Initial Catalog' was not provided in the connection string due to this, it was impossible to clean the cache of the database."); conn.Open(); using (var cleanCmd = new AdomdCommand(string.Format(xmla, csb["Initial Catalog"]), conn)) cleanCmd.ExecuteNonQuery(); } }
0
22. Example
View licensepublic IDbConnection Get(string connectionString) { var csb = new DbConnectionStringBuilder(); csb.ConnectionString = connectionString; string providerName = string.Empty; if (csb.ContainsKey("pbix")) { providerName = "Microsoft.AnalysisServices.AdomdClient"; var connectionStringBuilder = GetPowerBiDesktopConnectionStringBuilder(); connectionStringBuilder.Build(csb["pbix"].ToString()); connectionString = connectionStringBuilder.GetConnectionString(); } if (csb.ContainsKey("Provider")) providerName = InterpretProviderName(csb["Provider"].ToString()); if (string.IsNullOrEmpty(providerName) && csb.ContainsKey("Driver")) providerName = "System.Data.Odbc"; if (string.IsNullOrEmpty(providerName)) providerName = "System.Data.SqlClient"; if (string.IsNullOrEmpty(providerName)) throw new ArgumentException(string.Format("No provider found for connectionString '{0}'", connectionString)); return Get(providerName, connectionString); }
0
23. Example
View licenseprotected static void GetDatabaseInfo(ref Site site, string physicalPath, string remoteComputerName)/n ..... /n //View Source file for more details /n }
0
24. Example
View licensepublic static string GetProviderInvariantNameByConnectionString(string connectionString) { /n ..... /n //View Source file for more details /n }
0
25. Example
View licenseprivate void SyncSelectedObjects(TreeNode selectedNode, bool nodeChecked) { if (/n ..... /n //View Source file for more details /n }
0
26. Example
View licenseprivate void doOpen(string hostName) { networkErrorOccurred = false; /n ..... /n //View Source file for more details /n }